Visual Math

Turtle Geometry

Write Logo-style turtle programs, replay the drawing process, and inspect coordinate geometry with shareable visual state.

Scratchpad (not saved)

Turtle Viewport

Pan to inspect geometry, wheel to zoom, and replay the program action by action.

Step 0/9Start1.00x zoom
9 executed actions
1 user procedures
Bounds -1.00, -1.00
to 96.00, 96.00

Program Summary

Actions
9
Procedures
1
Segments
4
Last Output
None
Endpoint
(0.00, 0.00)
Heading
0.0°

Active State

Current Step
Start
Pen State
Down

Semantics

  • `HOME` resets both position and heading, matching classic turtle behavior.
  • `CS` clears the drawing history and returns the turtle to HOME.
  • `SETHEADING 0` points up, `90` points right, `180` points down, and `270` points left.
  • Reporter procedures can be used inside expressions, for example `FD DOUBLE 5`.
  • Use the Help drawer for runnable examples; the page-level reference book sits below the workspace.

Reference Book

Turtle Geometry

The Computer as a Medium for Exploring Mathematics

Harold Abelson and Andrea diSessa · MIT Press

A canonical reference for Logo-style turtle commands, recursive drawing, and geometry by program.

View Book

Turtle Geometry Help

Controls

1. Enter Logo-style commands in the editor. Use REPEAT, TO ... END, and MAKE to build more complex programs.
2. Drag the viewport to pan. Use the mouse wheel or trackpad to zoom in and inspect geometry.
3. Use Replay Build or the playback slider to step through the drawing sequence command by command.

Movement

FORWARD n / FD n: move forward n turtle steps.
BACK n / BK n: move backward n steps.
SETX n: move to an absolute x coordinate.
SETY n: move to an absolute y coordinate.
HOME: move to (0, 0) and point the turtle straight up.

Rotation

RIGHT n / RT n: rotate clockwise by n degrees.
LEFT n / LT n: rotate counter-clockwise by n degrees.
SETHEADING n / SETH n: set an absolute heading where 0 is up.

Pen And Screen

PENDOWN / PD: draw while moving.
PENUP / PU: move without drawing.
CLEARSCREEN / CS: clear the drawing and reset to HOME.

Procedures And Variables

TO name :arg ... END: define a procedure with zero or more inputs.
REPEAT n [ ... ]: run a block n times.
IF [condition] STOP: halt the current procedure when the condition is true.
MAKE "NAME value: assign a numeric variable.
OUTPUT value / OP value: return a numeric result from a procedure.

Suggested Examples

Square

The basic Logo square using a repeat loop.

REPEAT 4 [ FD 10 RT 90 ]

Procedure Spiral

Procedure, variable, and IF STOP working together to stop a spiral.

TO SPIRAL :SIZE
  IF [:SIZE > 30] STOP
  FD :SIZE
  RT 89
  SPIRAL :SIZE + 1
END

CS
SPIRAL 2

Coordinate Frame

Absolute moves with SETX and SETY.

CS
PU
SETX -15
SETY -10
PD
SETX 15
SETY 10
SETX -15
SETY -10
HOME

Reporter Procedure

OUTPUT used to report a value back into a movement command.

TO DOUBLE :N
  OUTPUT :N * 2
END

MAKE "SIDE 6
REPEAT 4 [
  FD DOUBLE :SIDE
  RT 90
]