Langton's ant
Controls
- Click or tap a cell to place the ant there while the simulation is paused.
- Space starts and stops the simulation when the field is focused.
- "Ant direction" sets where the ant faces at the start. It can only be changed while paused.
- "Grid size" can only be changed while paused and clears the field.
- "Speed" sets how many steps the ant takes per frame: from 1 to 5.
What you see here
This is a simulation of Langton's ant, a cellular automaton invented by Christopher Langton in 1986. The field consists of cells that are either black or white. The ant stands on one cell and faces one of four directions. The whole logic fits into two rules, but the behavior is more complex than it looks.
Rules
- If the ant is on a black square, it turns 90° left and changes the square color to white. Then it takes a step in its current direction.
- If the ant is on a white square, it turns 90° right and changes the square color to black. Then it takes a step in its current direction.
Who came up with it
The ant was invented by the American scientist Christopher Langton, one of the founders of artificial life research. In 1986 he proposed this simple cellular automaton, which is still a standard example in the field.
Why it is interesting
At first the ant draws a chaotic pattern that is hard to predict. After about 10,000 steps its behavior changes: the ant starts building a repeating diagonal highway along which it keeps moving. This shift from chaos to order makes the ant a convenient model for studying self-organization, cellular automata and computation. Start the simulation, change the grid size or speed, and compare how the ant behaves on different fields.