

You may only move one disk at a time and this disk must be the top disk on a peg.No disk may be placed on top of a smaller disk.All the disks are initially placed on the first peg (the 'A' peg).The towers are labeled 'A', 'B', and 'C'. There are n disks (1, 2, 3., n) and three towers (pegs).Fortunately, they are nowhere even close to being done. They are said to believe that when the last move of the puzzle is completed, the world will end in a clap of thunder. Monks, acting out the command of an ancient prophecy, have been moving these disks, in accordance with the rules of the puzzle, once every day since the monastery was founded over a thousand years ago. According to this myth (uttered long before the Vietnam War), there is a Buddhist monastery at Hanoi which contains a large room with three time-worn posts in it surrounded by 21 golden discs.


The puzzle is called "Towers of Hanoi" because an early popular presentation wove a fanciful legend around it. To help illustrate the power and elegance (yes, there are drawbacks as well) it provides, a classic problem known as the 'Towers of Hanoi' is often used.įor those unfamiliar with this classic, please allow me explain the history and rules. Many computer science professors eventually discuss the concept of recursion.
