This is great, I was just about to try to create this game myself, so I'm not going to look at your 'source' for a week or so, but I look forward to doing more than skim your blog :)
Very nice! I enjoyed the blog entry that comes with this project.
Download this project!
Download the 5 sprites and 19 scripts of "Tower of Hanoi" and open it in Scratch
Project Notes
This is a tower of hanoi that knows how to solve itself.
It is part of the 'Taste of ...' series http://chimu.wordpress.com/a-taste-of-scratch
Scratch is an unusual language to program the Tower of Hanoi in because it is missing procedures and recursion. But because of those restrictions, Scratch produces a very interesting and Object-Oriented result. It actually delegates to the Disks better than implementations in other languages like Smalltalk/Squeak or Ruby might choose to do.
Comments are in the Stage and the Sprite1 sprite. If you change Sprite1, simply delete the other sprites, duplicate Sprite1, and set the new Sprite2+ disk-ids appropriately. Sprite1 is the prototype for all the other Sprites (kind of like a 'class' but instance-based. See JavaScript, Self, etc. for examples).
Comments
You need to be logged in to post comments
Add a Comment
amazing 5/5
wow!!!
This is great, I was just about to try to create this game myself, so I'm not going to look at your 'source' for a week or so, but I look forward to doing more than skim your blog :)
Very nice! I enjoyed the blog entry that comes with this project.