The Hanoi TowersPost a comment View Comments (0)
This is an animation I hacked together to show how the problem of the Hanoi Towers is solved. It uses OpenGL. The viewport can be changed with the arrow keys. I wrote it in Free Pascal. If you want to play around with it, then you can get it here. There is a win32 executable (main.exe), but that will probably flash away too fast on any modern computer.If you don't want to recompile it, you can use cpukiller or similar software to slow down your computer. It's an ideal tool to show an animation in the classroom about how the hanoi towers are solved.
To compile natively under linux you need the following packages (for debian): fp-compiler, fp-units-rtl, fp-units-i386, fp-units-misc, fp-units-base. (you need to download them from sourceforge, as debian doesn't include them anymore)
To compile:andrew@charon:~/Hanoi Tornyai$ fpc main.pas
To Run:andrew@charon:~/Hanoi Tornyai$ ./main
- Compiling on windows shouldn't be much more complicated
- To slow down the animation, decrease the value of the Add constant on the 15th line of main.pas
- To change the number of disks, edit the value of N on the 16th line of main.pas