chickadee » simple-graphics

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

simple-graphics - Turtle graphics for teaching programming


A simple turtle graphics system for Chicken. The design goal is to allow people to start drawing pictures in Scheme without distracting boilerplate, like in the good old days of 8-bit micros. This allows for introductory programming exercises that give the reward of drawing pictures, rather than more abstract mathematical or "Hello, World!" problems.

Code repository

The source code for simple-graphics is hosted in Fossil at


Alaric Snell-Pym


Requires the doodle, miscmacros and parley extensions.

doodle uses the sdl and cairo eggs, which depend on some sometimes-hairy external C libraries; see the sdl egg documentation for tips on installing them on various platforms.

Quick Start

(use simple-graphics)

(forward 10)
(forward 10)
(forward 10)
(forward 10)


(red) (forward 1) (right 10)
(green) (forward 1) (right 10)
(blue) (forward 1) (right 10)
(orange) (forward 1) (right 10)
(yellow) (forward 1) (right 10)
(brown) (forward 1) (right 10)
(purple) (forward 1) (right 10)
(turquoise) (forward 1) (right 10)
(grey) (forward 1) (right 10)
(black) (forward 1) (right 10)
(pen-up) (backward 8) (left 80)

(pen-down) (forward 10)


The Turtle

In simple-graphics, you draw pictures by giving instructions to a turtle who lives in a window that will pop open on your screen. She's carrying a pen in her mouth, so she draws a line as she crawls unless you ask her to lift the pen up. And she's got a few different coloured pens on her back.

The turtle starts off in the middle of the window, pointing upwards, with the black pen down, and she crawls at ten pixels per step.

She can be made to go faster or slower than she currently crawls, or told to go at a specific speed. The normal speed of ten pixels per step is speed "1".

If you tell her she's going on an adventure, she remembers where she starts, and when the adventure is over, she returns to where she was when she started (no matter how lost she is at the end of the adventure; she's a homing turtle). You can have little adventures within big adventures, too.

Command Reference

forward stepsprocedure
forwards stepsprocedure

Moves forward the indicated number of steps. If the pen is down, then a line will be drawn with the current pen.

backward stepsprocedure
backwards stepsprocedure

Moves backward the indicated number of steps. If the pen is down, then a line will be drawn with the current pen.

left #!optional angleprocedure

Turns left by the indicated angle, which defaults to 90 degrees.

right #!optional angleprocedure

Turns right by the indicated angle, which defaults to 90 degrees.

turn direction angleprocedure

Turn in the specified direction (left or right) by the specified angle.


Lifts the pen up; no drawing will happen until the pen is again lowered.


Lowers the pen to the paper, so lines will be drawn when the turtle moves.


Switches to a different coloured pen.


Switches to a lighter or darker version of the current pen. Note that making the pen darker and then lighter again does not get you back to the same colour. Too many darkens will quickly get you to black, and too many lightens will quickly get you to white, so you probably only want a single darken or lighten after choosing a named pen colour!

faster #!optional factorprocedure

Makes the turtle go faster, by multiplying her current speed by the factor. The default is to double the speed.

slower #!optional factorprocedure

Makes the turtle go slower, by dividing her current speed by the factor. The default is to half the speed.


Ends all current adventures the turtle is on, and returns her to her home position, the middle of the screen, facing upwards; she switches back to the black pen, lowers it to the paper, and returns to the initial speed of ten pixels per step.


Replaces the paper with a fresh sheet, and sends the turtle back home as per the previous command.


Saves your current picture. The first time you do this, the turtle will ask you your name. When the picture is saved, it will tell you the file name it saved it as.

goto x yprocedure
go-to x yprocedure

Teleports the turtle to a given position on the screen, in pixels. 0 0 is the middle of the screen; increasing x goes right, increasing y goes up.

heading angleprocedure

Turns the turtle to point towards the indicated heading. 0 is up, 90 is right, 180 is down, 270 is left.

speed step-sizeprocedure

Tells the turtle to walk at the specified speed; a step-size of 1 indicates the default of ten pixels per step.

(adventure <body>...)syntax

Tells the turtle that the instructions in the <body>... are an adventure; at the end of the adventure, she is to restore her position, heading, pen colour, and pen up/down status to those at the beginning of the adventure.



See the BSD-style licence simple-graphics is available under.

Contents »