Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Recursion: the Towers of Hanoi problem

by pg (Canon)
on Oct 19, 2004 at 04:07 UTC ( #400403=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub movedisks { #to make this move
    
  2. or download this
      my( $num, $from, $to, $aux ) = @_;
      if( $num == 1 ) {
        ;
      } else {
    
  3. or download this
        #you have to make those two moves first
        movedisks( $num-1, $from, $aux, $to );
        movedisks( $num-1, $aux, $to, $from );
    
  4. or download this
      }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://400403]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-11-28 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (196 votes), past polls