OpenWorldLab
Ants: 1 Steps: 0 Trail: 0
Turmites (agent-driven) Agent-driven: a single read/write head on a two-colour grid Proved universal

Langton's Ant

One ant, two rules, and a result nobody can fully explain

One ant, two rules: turn right on white, left on black, flip the square, step forward. After about 10,000 steps of apparent chaos it starts building a straight diagonal highway.

How it works

In plain English, before the notation

An ant walks on a grid of white and black squares. On white it turns right, flips the square to black, and steps forward. On black it turns left, flips the square to white, and steps forward. That is all. For the first few hundred steps the trail is neat and symmetric. Then it becomes an apparently random scribble that lasts about ten thousand steps. Then, without anything changing, the ant locks into a 104-step cycle and builds a straight diagonal road that continues forever.

On a white square: turn 90° right, colour the square black, move forward one square.
On a black square: turn 90° left, colour the square white, move forward one square.
The grid never updates itself. Only the square the ant is standing on ever changes.
After roughly 10,000 steps the ant enters a repeating 104-step cycle that shifts it two squares diagonally each time — the "highway".

Wait for the highway

  1. Open Presets and load "Single Ant (the classic)" — one ant, empty grid.
  2. Set Speed to 60 fps in Settings and press Play. Watch the Steps counter in the dock rather than the generation count.
  3. Around step 10,000 the scribble stops growing outwards in all directions and a straight diagonal road begins. Nothing was added to make this happen.

Starting configurations

Loads straight into the simulator

Try any rule

The catalogue covers a few dozen rules. Here you can run any of the 262,144 two-state grid rules, or any of the 256 one-dimensional rules, including ones nobody has written up.

B3
B
Toggle:
S23
S
Toggle:
B3/S23 Likely: a mix, as in Conway’s rule
Birth: A dead cell becomes alive with 3 live neighbours.
Survival: A live cell survives with 2 or 3 live neighbours, and dies otherwise.

Well-known rules

Where it came from

Christopher Langton described the ant in 1986 as part of his work on artificial life. It is the simplest well-known example of a turmite: a machine with an internal direction that moves over a grid, reading and writing one cell at a time. That makes it a Turing machine on a two-dimensional tape rather than a cellular automaton.

The three-phase behaviour was found by simulation, not predicted from the rules, and it is still not derived from them. Bunimovich and Troubetzkoy proved that the ant’s path must be unbounded — it cannot stay in a finite region forever — but that is a much weaker statement than "it always builds a highway".

The rule, precisely

What each cell looks at

None. The ant reads only the cell it occupies.

What a cell can be

Two colours per cell, plus the ant’s position and its heading (up, right, down or left)

The update

heading' = heading + (colour = white ? +90° : −90°); colour' = 1 − colour; position' = position + one step in heading'

Written as the turn string RL: turn Right on colour 0, Left on colour 1. Longer strings such as LLRR describe ants with more colours, one turn per colour.

Three phases, in order, every time

Starting from an empty grid, the same sequence occurs on every run:

  • Roughly steps 0–500: small, visibly symmetric shapes.
  • Roughly steps 500–10,000: an irregular patch with no discernible structure, spreading in all directions.
  • From about step 10,000: a 104-step cycle that moves the ant two squares diagonally per cycle, producing an unbounded straight road.
  • The transition is not triggered by anything. The ant is running the same two rules throughout.

The ant can compute

Gajardo, Moreira and Goles showed in 2002 that a suitable arrangement of black and white squares makes the ant simulate an arbitrary boolean circuit, which is enough for universal computation.

The same work showed that predicting the ant’s trajectory is P-complete: there is no known way to shortcut the simulation. That is why nobody has simply calculated when the highway begins.

Agents that modify their environment

StigmergySwarm roboticsDeterministic chaos

The ant is a minimal model of stigmergy — the mechanism by which ants and termites coordinate by changing their environment rather than by communicating directly. Its other use is as a demonstration that "unpredictable" does not require randomness: this system is fully deterministic, and the outcome is still not derivable without running it.

Things to try

  • The Steps readout in the dock counts individual ant moves, which is the number quoted in the literature. The simulator runs several moves per displayed frame so the motion is visible.
  • Once the highway has started, pause and draw a short black wall across it with the Pencil. The ant is usually thrown back into a chaotic phase, and will eventually build a new highway in some other direction.
  • Use the Place Ant tool to add a second ant. Two ants interfere with each other’s trails and neither follows the usual schedule.

Frequently Asked Questions

On an empty grid it always has, in every simulation anyone has run. Whether it must, for every finite starting configuration, is an open problem. What has been proved — the Cohen–Kung result — is only that the ant’s path cannot stay inside a bounded region.

References

Other rules in this family

Browse by family

Lab overview →