HomeArticlesLangton's Ant

Langton's Ant: Two Rules, One Ant, and an Emergent Highway

How a two-rule, two-dimensional Turing machine goes from chaos to a repeating diagonal highway.

mysimulator teamUpdated June 2026≈ 7 min read▶ Open the simulation

Two rules, an ant, and a grid of squares

Langton's Ant, introduced by computer scientist Chris Langton in 1986, is one of the simplest systems in computer science ever shown to produce genuinely complex, unpredictable behaviour. The setup: an infinite grid of square cells, each either black or white; a single "ant" sitting on one cell, facing one of four directions. Every step, the ant follows exactly two rules, based only on the colour of the cell it is currently standing on:

on a WHITE cell: turn 90° clockwise, flip the cell to BLACK, move forward one cell
on a BLACK cell: turn 90° counter-clockwise, flip the cell to WHITE, move forward one cell
live demo · an ant carving a path across a black-and-white grid● LIVE

This is formally a two-dimensional Turing machine: the ant is a read/write head, the grid is an infinite tape extended into two dimensions, and the two rules are its entire program. There is nothing hidden and nothing random — the ant's future is completely determined by its starting position, orientation, and the two rules above.

Three phases: chaos, chaos, then a highway

Starting from an entirely white grid, the ant's path goes through three visually distinct phases. For roughly the first 500 steps, it draws small, simple, often symmetric patterns, revisiting cells near its start. From about step 500 to roughly 10,000, the pattern looks genuinely chaotic — dense, irregular scribbles with no obvious structure, the kind of trajectory that looks like it could continue forever without ever settling down.

Then, without warning, around step 10,000 (the exact number varies slightly by starting orientation), the ant escapes the chaotic mess and begins building a "highway": a diagonal strip of 104 steps that repeats forever, carrying the ant steadily off to infinity in a straight overall direction while tracing the same small repeating figure. Nobody has proven mathematically why the highway must eventually appear from every starting configuration on an initially blank grid — it is an empirical fact, observed in every simulation ever run, but the general question of whether Langton's Ant always eventually builds a highway from any finite initial black-and-white pattern remains an open problem in the mathematics of cellular automata.

Why such a simple rule can surprise you

Langton's Ant belongs to the same family of ideas as Wolfram's elementary cellular automata and Conway's Game of Life: minimal local rules, applied deterministically and repeatedly, can generate behaviour far richer than the rule itself suggests — a theme sometimes called emergence. It is also a favourite demonstration of why simulating ahead is often the only way to know what a simple deterministic system will do: there is no shortcut formula that tells you where the ant will be at step one million without actually running all one million steps, a property closely related to the idea of computational irreducibility.

Variants extend the idea with more than two colours and more than two turning rules — some of these produce even more elaborate structures, including some capable of the same kind of universal computation found in Conway's Game of Life.

Frequently asked questions

Does Langton's Ant ever repeat itself exactly?

Once it settles into the highway phase, yes — it repeats a fixed 104-step pattern forever while drifting diagonally across the grid. Before that, during the initial chaotic phase, the ant's path does not exactly repeat and looks unpredictable, even though it is fully deterministic.

Will the highway always eventually appear?

From a blank grid, every simulation ever run has produced a highway, typically within about 10,000 steps, but proving that this must always happen from every finite starting pattern is an open mathematical question — it has been verified extensively by computer, not proven in general.

Is Langton's Ant random?

No, it is entirely deterministic. The same starting position, direction and grid will always produce exactly the same sequence of moves; what looks like randomness during the chaotic middle phase is really just a simple rule producing behaviour too intricate to predict by eye.

Try it live

Everything above runs in your browser — open Langton's Ant and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Langton's Ant simulation

What did you find?

Add reproduction steps (optional)