So, the monks start moving disks back and forth, between the original pile, the pile at the new location, and the intermediate location, always keeping the piles in order (largest on the bottom, smallest on the top). The legend is that, before the monks make the final move to complete the new pile in the new location, the temple will turn to dust and the world will end. Is there any truth to this legend?
The Problem (based on this legend). You have a small collection of disks (with holes in the center) and three pegs onto which you can put them. The disks all start on the leftmost peg, and you want to move them to the rightmost peg, never putting a disk on top of a smaller one.
Try to solve this problem yourself.
In the SIPE-2 plan drawing, there is only one action:
|MOVEDISC||Moves the named disk from its current peg to the given peg|
If the arguments are printed, the first argument in the disk (DA is the smallest, DB the next smallest, etc.), and the second argument is the peg to which it should move (A, B, or C). The pegs start on peg A and must move to peg C.
Click here to see the SIPE-2 input file for Tower of Hanoi.
Wilkins Home Page SIPE-2 Home Page
David E. Wilkins Last modified: Tue May 4 18:46:15 1999