The Lab · Chris Langton, 1986

Langton's Ant

An ant walks on an endless grid of squares. Two rules, no plan, and no randomness. Watch what it builds.

The rule

On an empty square, the ant turns right. On a filled square, it turns left. Either way, it flips the square's colour and steps forward one square.

emptyfilledthe ant

What to watch for

  1. Order. For a few hundred steps it makes neat, symmetric shapes.
  2. Chaos. Then a growing, messy blob for about 10,000 steps.
  3. The highway. Suddenly it repeats the same 104 steps forever, marching off diagonally.

Run

500

The rules can be run in reverse. Play it backwards and the ant undoes every step, all the way back to where it began.

Progress

Steps0 Filled squares0 Highwaynot yet

Start from

Or draw your own: at step 0, click squares on the grid to fill or empty them. Then press Play. Does the ant always end up building the highway? Nobody has proved it does.

View

Otherwise the view zooms out to keep everything the ant has touched on screen.

Share

The link holds your starting squares and the step you're on. The ant always does the same thing from the same start, so whoever opens it sees exactly what you see now.