|
Forum Index : Microcontroller and PC projects : Towers of Hanoi Puzzle
| Author | Message | ||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
Attached is a ZIP file for the Towers of Hanoi puzzle, a CMM2 MMBasic program I recently completed. The Towers of Hanoi puzzle consists of three towers the first of which holds a number of disks of steadily decreasing size, just like a kid's stacker toy. The object of the puzzle is to move the disks from the first (left-hand) tower to the center tower. But, there are two restrictions: a) You can only move one disk at a time b) At all stages of the solution, you can NEVER have a larger disk on top of a smaller disk. Persons familiar with the puzzle know that for N disks, the solution that uses the fewest number of moves is 2 raised to the Nth power, minus one. This program lets you select the number of disks from 3 to 12, choose an automatic solution which can be single-stepped, or a manual solution where you move the disks yourself. The program will tell you when you succeeded and if you used only the minimum number of moves. Enjoy! -Bill Hanoi.zip |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |