[Newbies] Understanding SnakeGame

Randal L. Schwartz merlyn at stonehenge.com
Wed Jan 14 15:14:19 UTC 2009

>>>>> "Filip" == Filip Malczak <filet00 at gmail.com> writes:

Filip> So we have a SnakeGame (you can get it with Wolrd->open-SqueakMap Package
Filip> Loader). I wanted to look at its code to uderstand it, and learn how to
Filip> write in Squeak (not syntax, but algorithms, etc). And so I have this
Filip> problem:
Filip> I know how to make the snake go, but where and how do I create gameboard?
Filip> And 'New Game' and 'Quit' buttons?
Filip> If anyone could explain me EXACTLY step by step how is the game going - I'd
Filip> be very pleased.

first, load the package from squeakmap.

then, make a SnakeGame Morph (world menu, new morph, from alphabetic list, s,

Once you have a game morph, bring up halos on it (command-click on mac),
and look for the tool icon on the right.  select "browse morph's class".

>From there, you can see in the #initialize code that it eventually
calls #makeControlPanel, which makes those buttons.  It also starts
stepping, and in #step are the "live" actions.  You might also want to
browse the "SnakeMorph" class to see how the board itself works.

Hope that helps.

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

More information about the Beginners mailing list