|
Squeak
What is Squeak?
- Squeak is an open-source implementation of
the Smalltalk
programming language and development environment.
- Etoys is a graphical programming
environment within Squeak. Etoys is designed to enhance science
and math education by encouraging exploration and experimentation.
-
The One Laptop Per Child (OLPC)
initiative ships Squeak Etoys as one of the bundled applications.
Getting started with Squeak Etoys
Tutorials will be given in class and during lab time in the
Engineering Workstation Labs.
You should take a look at the
Etoy Quickstart Guide
(NOTE: our version of squeak is slightly different than described
here, but most things are the same).
Also, there is online help within Squeak (click the help button).
The following are some useful Etoys projects for getting started
(After installing Squeak, click on an image to download/run the project file).
|
EtoysChallenge
A simple introduction to tile-based programming in Etoys. The project contains 7 challenges in which you create simple scripts to drive a car to a goal location. Each challenge becomes a bit more difficult.
|
|
LunarLander
Example of an Etoys-based game. Use the joystick to control a rocket thruster, so that the spaceship sets down gently on the landing pad. Examine all the scripts and try to figure out how this project works.
|
|
BouncingBallAnimation
Animation example.
|
|
SalmonSniff
An animated fish follows a gradient (a simple model of chemotaxis behavior).
|
Installing Squeak
In MCB 419, we are going to use a special version of Squeak Etoys,
dervied from the OLPC version.
The correct version has already been installed for you in the
Engineering Workstation (EWS) labs.
In order for Squeak to find your files, you'll need to create a
folder called 'mcb419' (with no blank spaces) in your EWS Home Directory.
We will go over this procedure together in the computer lab.
If you want to install this verion of Squeak Etoys on your home computer or
laptop, follow the instructions below:
Windows version
- Download squeak419.zip to your
Desktop.
- Unzip it to 'C:\Program Files' to create 'C:\Program Files\squeak'.
- Create a new folder where you want to keep your own squeak projects (e.g.
'C:\My Squeak', or 'C:\Documents and Settings\USERNAME\My Documents\squeak'.
Pick a convenient spot... the choice is up to you.)
- Navigate to C:\Program Files\squeak, then open the file 'SqueakPlugin.ini'
in a text editor like Notepad. Under the [Security] section, change the
UserDirectory to match the full path to the folder you created in the
previous step. Save and close the SqueakPlugin.ini file.
- Right click
on the SqueakPlugin.exe file and select 'Send To Desktop (create shortcut)'.
This will create a shortcut to Squeak on your desktop.
- associate *.pr files with squeak
In the menubar at the top of any file explorer window,
select 'Tools -> Folder Options -> File Types'
Click 'New', add file extension 'pr', click 'Change...'
Browse to 'C:\Program Files\squeak\SqueakPlugin.exe'
Check 'always use the selected program to open this kind of file'
- Test your installation by clicking on one of the project files above on
this web page (like EtoysChallenge).
Click the 'Open' button; the project should open in Squeak. If you deselect the 'always ask' option, then project files should launch automatically in the future.
- If everything worked, you can delete the squeak.zip file from your desktop.
- If you're having problems, contact Prof. Nelson for help.
Mac OS X version
Need a volunteer to help test/document/improve the Mac OS X procedure. The following instructions should get you started.
- download and unzip squeak419osx.zip to your Desktop.
- open the newly created squeak419osx folder and
drag "squeak419.image" onto "squeak.app"
- the 419 version of squeak should now be open (orange background, 'MCB 419' in the title bar')
- to open a project file, drag the *.pr file onto the squeak desktop, OR click-and-hold the open-project icon (third icon from the right in the squeak toolbar) and navigate to the project
- for web-links, you'll have to save the project to disk first, and then open it using one of the methods just described
Linux (386) version
Need a volunteer to help test/document/improve the linux procedure. The following instructions should get you started.
- download and unzip squeak419unix.zip
- in a terminal window, cd to the newly created squeak419unix folder
(you can rename it if you like)
- make the etoys.sh script executable (chmod +x etoys.sh)
- type etoys.sh at the command prompt and let me know what happens
Frequently asked questions (FAQ)
- Where do I find the
random function?
In the SCRIPT window, click on the toolbox icon (to the right of the clock); the random function is the third item from the top of the list. Click on the random tile and drop it on any element in your script that is expecting a numeric value.
- How do I create/manipulate a new variable?
To create a new variable, you need to click on the 'V' button at the
very top of the object's viewer. (The button is to the the right of
the object's name). That will bring up a dialog box to let you enter
the new variable name, which will then appear under the "variables"
category in the viewer.
There are two different ways to "pick up" a variable for use in your
scripts. You can either pick up just the variable itself (e.g.,
Ellipse var1) or you can pick up an entire assignment statement
(Ellipse var1 ← 1.0).
To pick up the entire assignment statement, you need to click on the
left pointing green arrow (←). When your mouse hovers over the
arrow, you'll see a message like "drag from here to obtain an
assignment phrase".
That's what you need to do when you want to assign a new value to the
variable in your script.
Sometimes you'll just need the "value" of the variable, not an entire
"assignment statement". In that case, click-and-drag on the variable's
name, rather than on the green arrow.
For example, if you create a new variable called "mySpeed". You'd need
to click-and drag on the green arrow to add a statement like
bot's mySpeed ← 4.0 to your script.
On the other hand, if you already have a line in your script that
says "bot forward by 5", you would drag the variable name alone
on top of the "5" to produce
"bot forward by bot's mySpeed".
|