s LearnSqueak.com

PLAY WITH THE SYSTEM YOU ALREADY HAVE

Built-in demos.
Real objects to explore.

Atoms, clocks, flashing lights, and games are already inside this Squeak image.

Launch six bundled examples, watch how they behave, then inspect their classes. Every launch block was executed in the standard Squeak 6.1 image used here. No add-on package was installed for these demos.

6 built-in examples4 recorded GIFsSource inside your image

TWO WAYS TO OPEN A DEMO

Use the catalog, or send a message.

  1. Click an empty part of Squeak’s desktop to open the World menu.
  2. Choose objects, then categories.
  3. Choose Just for Fun for BouncingAtoms, Digital Clock, and Flasher; choose Games for Tetris, Same, and Mines. Drag the desired tile into the world.

In this image, these examples are not all in the category named Demo. The screenshots show their actual catalog placement. Smaller or customized images may omit them.

REAL SQUEAK CAPTURESCREENSHOT
Squeak Objects catalog with Just for Fun selected
Actual Just for Fun catalog in Squeak 6.1.
REAL SQUEAK CAPTURESCREENSHOT
Squeak Objects catalog with bundled Games selected
The Games catalog also shows Chess, Chess 960, ChineseCheckers, Cipher, Crostic, and FreeCell; this lesson focuses on the three tested games below.

For code, open Tools → Workspace, paste one complete block, select it, and choose do it. Try one demo at a time; each starts at 100@100 and may overlap another. The final demo returns the object, so you can choose inspect it instead of do it if you want an Inspector.

Try the finished example

Run in the SqueakJS playground

The separate playground loads the real Smalltalk image on demand. This lesson keeps its native setup instructions; browser compatibility notes appear beside each demo.

01

BouncingAtomsMorph

Bouncing atoms

Thirty tiny atoms move inside a bounded Morph. This is John Maloney’s built-in bouncing-atoms simulation, not the ball class from our earlier tutorial.

Workspace · select all, then Do it
| demo |
demo := BouncingAtomsMorph new.
demo position: 100@100; openInWorld; startStepping.
demo
Download .st
REAL SQUEAK CAPTUREGIF WALKTHROUGH
Bouncing atoms running in Squeak
Recorded directly from the running built-in object. Stop returns to the still image.

Use its halo menu to find start bouncing, set atom count, start infection, and show infection history. The infection option is a visual simulation. Start with the default 30 atoms; its stepTime requests updates as fast as possible, so large counts can make the image busy.

02

ClockMorph

A digital clock

A small live object that reads the Squeak machine’s current time. The code below enables seconds, uses 24-hour format, and requests a larger font from the image’s default text style.

Workspace · select all, then Do it
| demo |
demo := ClockMorph new.
demo font: (TextStyle default fontOfSize: 24);
    showSeconds: true;
    show24hr: true;
    position: 100@100;
    openInWorld;
    startStepping.
demo
Download .st
REAL SQUEAK CAPTUREGIF WALKTHROUGH
A digital clock running in Squeak
Recorded directly from the running built-in object. Stop returns to the still image.

Change the showSeconds: or show24hr: argument to false to change the display. The catalog also has an analog item named Clock; this example intentionally uses the separate Digital Clock class. The GIF is a recording, not your current local time.

03

Flasher

A blinking Morph

Flasher alternates its on color with a darker version every 500 milliseconds. initializeToStandAlone supplies the setup used by a standalone catalog object; we then choose orange and a 60-pixel size.

Workspace · select all, then Do it
| demo |
demo := Flasher new.
demo initializeToStandAlone;
    onColor: Color orange;
    extent: 60@60;
    position: 100@100;
    openInWorld;
    startStepping.
demo
Download .st
REAL SQUEAK CAPTUREGIF WALKTHROUGH
A blinking Morph running in Squeak
Recorded directly from the running built-in object. Stop returns to the still image.

Change onColor: to another Color. The animation is opt-in and can be stopped immediately with the web control. This demo contains blinking color. Skip Play if blinking is uncomfortable. Starting or stopping the website GIF does not control the Squeak object.

04

Tetris

Tetris: controls and stepping

The bundled falling-block game combines a board, score display, buttons, keyboard handling, and stepping. It starts a game when created.

Workspace · select all, then Do it
| demo |
demo := Tetris new.
demo position: 100@100; openInWorld.
demo
Download .st
REAL SQUEAK CAPTUREGIF WALKTHROUGH
Tetris: controls and stepping running in Squeak
Recorded directly from the running built-in object. Stop returns to the still image.

Use the visible movement/rotation/drop buttons, or give the game keyboard focus by moving into it: left/right move, up/down rotate, and Space drops. Click Pause before switching tasks, New game to restart, or Quit to remove it. The GIF records actual falling pieces.

05

SameGame

Same: groups and board state

Select connected tiles of the same color, then remove the group to score points. This is labeled Same in the catalog, while its class is SameGame.

Workspace · select all, then Do it
| demo |
demo := SameGame new.
demo position: 100@100; openInWorld.
demo
Download .st
REAL SQUEAK CAPTURESCREENSHOT
Same: groups and board state running in Squeak
Actual initial game state; new games generate different boards.

Click a group once to select it; click again within that group to remove it. Adjacent means up, down, left, or right. Tiles slide down and right to fill gaps. Hint finds a group, New game resets the board, and the built-in help explains scoring.

06

Mines

Mines: inspect before you click

Squeak’s bundled mine-finding game has a board of concealed tiles. Revealed numbers count adjacent mines, including diagonals. It is useful for studying stateful tiles and event handling.

Workspace · select all, then Do it
| demo |
demo := Mines new.
demo position: 100@100; openInWorld.
demo
Download .st
REAL SQUEAK CAPTURESCREENSHOT
Mines: inspect before you click running in Squeak
Actual initial game state; new games generate different boards.

Click a tile to reveal it. Shift-click a suspected mine to flag it; the help also describes the configured yellow-button gesture. Use New game to restart. Read the in-game help, but use the actual board’s counters for the current level rather than assuming a fixed mine count.

KEEP THE IMAGE RESPONSIVE

Stop, remove, then investigate.

Use a game’s own Pause or Quit control where supplied. Otherwise open the outer Morph’s halo (commonly Alt-click on Windows/Linux or Option-click on macOS) and use its red delete handle. Gesture mappings can vary. Remove the whole game, not an individual tile.

For controlled cleanup, evaluate the launch block with inspect it so you keep an Inspector on the returned demo. In that Inspector’s evaluation pane, the following stops stepping for the demo and its children, then removes the demo:

Inspector on the demo · Do it
self allMorphsDo: [:each | each stopStepping].
self delete.

Use this only in an Inspector on your tutorial demo. In an ordinary Workspace, self is not that Morph. The temporary demo variable from an earlier do-it does not survive into a new evaluation.

Open a Browser on the named class to read initialize, step, stepTime, and event-handling methods. Read core classes freely; experiment in a subclass or copied tutorial class rather than changing the bundled game for everyone in the image.

Learn the development tools

Where these examples come from

Names, catalog categories, launch behavior, and controls were checked against the running Squeak 6.1 image and each class’s descriptionForPartsBin, initialization, stepping, and help methods. These methods are available in your image’s Browser.