Wikipedia describes The Towers of Hanoi as a mathematical puzzle that has become a popular example of the concept of recursion. On this page, we have provided the puzzle, several options used to create variations of it, a method of playing these games manually, and solutions to many of the combinations. We made this program to educate, entertain, and strive for the best solutions to these variations. You can view the project on GitHub if you have feedback or contributions. Thanks for visiting.
URL for this configuration:
The classic Towers of Hanoi puzzle has two rules:
To win, following these rules, transfer all of the disks to the tower farthest to the right in size order. Even in this basic case, this may prove to be much more difficult than expected, and the number of moves it takes to finish grows exponentially as you increase the number of disks.
This page provides several ways to play. These methods can be put into two categories: manual and automatic ones. You can play manually by clicking a tower to take off the top disk and clicking another tower to place it. In addition, you can do the same thing by using the number keys to indicate the tower you want to move to or from, although this doesn't work for towers greater than 9.
For the automatic methods, depending on what options you have provided, there might be a built-in Solution that you can watch. To see if we have implemented a solution for this setup, check the Minimum Moves field; if it shows something other than "Unsolved", click Start to begin the solution and Stop to stop it. Also, if you have come up with your own solution and want to save the moves you made, check Export Moves, copy the contents of the box that appears, check Import Moves, paste the contents into the box that appears, and press Start. It will then execute the moves you did previously. The program will use this method as long as you keep the Import Moves box open and it contains moves. For both of these automatic methods, you can adjust the Delay field to change the number of milliseconds the the program will wait in between moves. What happens when the program finishes making the moves depends on the selected Mode: selecting "Wait" will make it await further input, "Repeat" will restart the solution with the same options selected, and "Increase" will restart the solution with one additional disk.
We have also provided some additional information fields in the Solution fieldset that deserve mentioning:
Once you get a hang of playing the game, you might want to change up the Settings. Most programs like this one only have you adjust the number of disks, whereas this one provides many other settings that deserve explaining:
Lastly, you can enable several Restrictions. These restrictions have been labeled in an obvious way, so we won't explain what each of them does. However, if you enable any of the restrictions regarding shade, and you have enabled Change, two additional settings appear:
If you don't set any additional restrictions, you can also select Star Towers. To make a tower a star tower, check the checkbox on top of it. If you have selected star towers, moves must either be from or to them.
Finally, if you want to share the options you have set, copy the URL for this configuration.
Copyright © 2010-2015 Brandon Evans. All Rights Reserved.
Special thanks to Fred Lunnon for his Java implementation I based this page on, Victor Mascolo for inventing the original Multistack Hanoi puzzle and models (U.S. patent number 7,566,057), Paul Stockmeyer and Steve Minsker for their papers on several variations as well as other contributions, Alex Munroe for his example of a custom built generator as well as other assistance, Chris Santiago for design help, James Rhodes, Ian Rahimi, and Samuel Sieb for support, and my sister, Lindsay Evans, for proposing an alternative solution to the Classic multiple stacks problem, and for being supportive with all of my endeavors.