Copyright © 2009 Purdea Andrei

The Hanoi Towers

Post 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. download 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