Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:22 12 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Towers of Hanoi simulation

Author Message
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 01:25pm 10 Aug 2014
Copy link to clipboard 
Print this post

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: Germany
Posts: 723
Posted: 10:14pm 10 Aug 2014
Copy link to clipboard 
Print this post

Not reversion but recursion ;-)
 
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 12:46pm 11 Aug 2014
Copy link to clipboard 
Print this post

Thanks atmega8... slip of the pen, or a senior moment... not sure which.
Hugh
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025