Your skill will accomplish
what the force of many cannot
Recursion: The Towers of Hanoi problemby DigitalKitty (Parson)
|on Oct 19, 2004 at 00:37 UTC||Need Help??|
Many computer science professors eventually discuss the concept of recursion. 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. For those unfamiliar with this classic, please allow me explain the history and rules...
The puzzle is called "Towers of Hanoi" because an early popular presentation wove a fanciful legend around it. 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. 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. They are said to believe that when the last move of the puzzle is completed, the world will end in a clap of thunder. Fortunately, they are nowhere even close to being done.
Any suggestions on how to 'fine tune' this program are more than welcome.
Hope this proves interesting.
20041023 Edit by Steve_p: Changed title from 'Visiting the Towers of Hanoi.'