Towers of Hanoi

Legend has it that in a temple in the Far East, priests are attempting to move a stack of disks from one peg to another. The initial stack had 64 disks threaded onto one peg and arranged from bottom to top by decreasing size. The priests are attempting to move the stack from this peg to a second peg under the constraints that exactly one disk is moved at a time, and at no time may a larger disk be placed above a smaller disk. A third peg is available for temporarily holding disks. Supposedly the world will end when the priests complete their task, so there is little incentive for me to facilitate their efforts but here is the solution for 4 disks:



Implemented by Oguzhan Kocatepe ©1997.

1