Smalltalk Toybox

A tiny object with a big sense of direction. Send the duck a few messages and guide it to the golden square.

0 of 5 delivered

The first delivery

Columns A–F, rows 1–6. Dark squares are blocks. Gold is the delivery spot.

Tell the duck.

Tap to add messages, or type your own. A full stop separates each message.

Try duck forward: 3. or duck left.

Ready. The duck starts facing east. Your first tape is already loaded.

Small talk. Real idea.

In Smalltalk, objects receive messages. Here, duck is the receiver, forward: is the message selector, and 3 is its argument. The duck decides how to respond.

left and right take no argument. forward: takes a number. The colon matters. Turning changes which way the duck faces; it does not move it.

Inspect, then try again.

Watch the position and heading beneath the board. Use One message to find the request that sends your delivery astray. Rewind returns the duck to its start without erasing your tape.

Exactly what this toy understands

This is a tiny Smalltalk-inspired interpreter, not Squeak or a full Smalltalk environment. The duck and its three methods are invented for this toy.

duck forward: 1.
duck left.
duck right.

Use 1 to 5 steps per forward message and at most 40 messages. A final full stop is optional. No variables, loops, cascades or arbitrary JavaScript are executed. Your program stays in this browser.