How to Use Squeak on a PC
We'll use the Towers of Hanoi program from A Taste of Smalltalk, by
Kaehler and Patterson.
- You'll need to download the zip file Squeak23.zip, which is about 5
megs in size. Extract the files using Zip or a similar utility. Or
download and execute the self-extracting
archive of Squeak2.3. In either case, you'll need about 15
additional megs for the extracted files. Install the files in the same directory.
- Run Squeak by dropping the Squeak IMAGE file onto the Squeak 2.3
Application icon. It should come up very quickly, or not at all :-)
- Use a right mouse click to bring up the open menu, and open the
System Browser.
- In the Browser, the four windows across the top are called A
(class categories), B (class names), C (message categories), and D
(message selectors).
- Select kernel-objects in area A, then Object in area B. Move the
mouse into area C, and with a right mouse click bring up a menu and
select "Add Item". When the little type-in window appears, type games.
- Move the cursor into area E, the text window, and type in the program.
- Do a right mouse click, and select accept. If there are any
syntax errors or warnings, this is when you'll see (most of) them.
- Since the moveDisk routine hasn't been defined yet, Squeak will
ask you to confirm that it should accept the moveTower method "as is".
- In area D, click the mouse so that moveTower is not
selected, and then type the moveDisk method into area E.
- When moveDisk is typed in, do an accept on it as well.
- Open the transcript window.
- Select moveTower in area D, and then mouse over the command at
the bottom, which begins with (Object new). Don't include the quotes.
- Select "do it", and watch it execute.
- If you want to save your work, then move the mouse to area C, and
select the fileOut menu item. This will create a file called Object-games.st.
- To read it all back in, you need to open the System Browser, and
enter the command (FileStream oldFileNamed: 'Object-games.st')
fileIn. and select the doIt command.