Steps Symmetry
1
2
11

More about Langton's Ant

Langton's Ant

Langton's Ant is a two-dimensional Turing machine invented by Chris Langton in 1986. On a white square it turns right, flips the square to black, and steps forward. On a black square it turns left, flips the square to white, and steps forward. From an empty grid those two rules pass through symmetry, a long chaotic tangle, and then a diagonal highway that repeats every 104 steps.

How it works

  1. Open this page and press play. The ant starts on an empty grid and builds the first symmetric patterns.
  2. Speed up to cross the chaotic phase, or open the Highway favourite to jump past 10,000 steps.
  3. Change the rule (RLR, LLRR, LRRRRRLLR), add ants, switch to hexagons or a turmite, then save a PNG.

Two turns, one step

Every cell is white or black, and the ant has a direction. On white it turns 90° clockwise, paints the cell black, and moves one square forward. On black it turns 90° anticlockwise, paints the cell white, and moves one square forward. Nothing else is random. The same start always makes the same picture.

Symmetry, chaos, then a highway

On an empty grid the first few hundred steps are small and often symmetric. From roughly step 500 to step 10,000 the ant is tangled in its own trail and the picture looks like noise. After about 10,000 steps it falls into a cycle of 104 moves.

Each cycle lays two more cells along a diagonal, so the ant builds a highway and walks away in a straight line forever.

Colours, colonies, hexes and turmites

A rule such as RLR or LLRR gives every colour its own turn, and the ant cycles the colour instead of flipping black and white. Several ants share one grid and can erase each other's highways. On a hexagon the same idea uses six directions.

A turmite adds a private state, so the turn depends on both the cell and what the ant remembers.

Using the app

Play the ant, change its turn rule, or drop more ants on the grid.⁣

Frequently asked questions

What is Langton's Ant?

A cellular automaton Chris Langton published in 1986. One ant walks an infinite grid of squares. The color under the ant decides a 90° turn, the ant flips that color, and then it steps forward.

What are the three phases?

From an empty grid: simple, often symmetric patterns for about the first 500 steps; a chaotic tangle until about step 10,000; then a highway, a cycle of 104 steps that builds a diagonal road forever.

What does a rule like RLR mean?

Each letter is the turn for one color. R is right, L is left. The ant writes the next color and steps forward. RL is the classic black-and-white ant. Longer rules such as LLRR and LRRRRRLLR grow different patterns, including symmetric geometry.

What is a turmite?

An ant with a memory. The turn and the color it writes depend on both the cell and the ant's own state, so the rule can change as it walks. The Spiral, Weave, and Drift favorites are two-state turmites.

Does Langton's ant always build a highway?

Nobody knows. From an empty grid the classic RL ant reaches its 104-step highway after about 10,000 steps, and it has been proved that the ant can never stay inside a bounded area. That every finite starting pattern ends in a highway is still an open conjecture. Set Pointer to Paint cells to try your own start.

蘭頓螞蟻: how do I record a video?

Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device.Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner.The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF.You can add one of three music tracks: calm, bright or beat.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

前往編輯器