![]() |
Forum Index : Microcontroller and PC projects : Towers of Hanoi simulation
Author | Message | ||||
shoebuckle Senior Member ![]() Joined: 21/01/2012 Location: AustraliaPosts: 189 |
Bert Holmes has written a nice little simulation of the solution of the Towers of Hanoi puzzle in which you have to move a number of different sized disks, one at a time, from one pin to another, using a third pin, without putting a larger disk on top of a smaller one. Features of Bert's code allow you to choose the number of disks (1-7) and the source and target pins. He also shows you how to change the simulation speed. An interesting part of his code is that he has used reversion (a routine calling itself). There are three versions in MMLib at http://geoffg.net/maximite.html#Downloads: - Towers.bas for MiniMite with VT100 terminal such as Tera Term - Bert's original. - Towers1.bas a conversion I did for MaxiMite with PC keyboard and VGA screen just changing the VT100 escape codes to PRINT @(x,y). - Towers2.bas a modification of Towers1 to change the display from characters to graphics, using a FONT file (Towers.fnt), and ask for the speed (1-5 where 1 is fast). Someone might like to create another version for the Colour MaxiMite. I don't have one so didn't feel confident to make the mod even though it doesn't look that difficult. If you do, send it to mmlib@geoffg.net and I will add it to the library. Cheers, Hugh |
||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 723 |
Not reversion but recursion ;-) |
||||
shoebuckle Senior Member ![]() Joined: 21/01/2012 Location: AustraliaPosts: 189 |
Thanks atmega8... slip of the pen, or a senior moment... not sure which. Hugh |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |