Ants and Turmites
A grid of cells, a walker, and a table of rules. The table is the whole program. Nothing here is random after the start: the same table always draws the same picture.
The grid is unbounded: nothing wraps at an edge. Large windows are slow on phones; 128 or 256 is plenty.
Numbers to check the page against
Measured with a separate script before this page was written. Choose a preset, type the step count under Counts and press Go; the page should show these values.
| Preset and steps | Expected black cells | Expected box |
|---|---|---|
| Langton's ant, 11,000 | 834 | 67 × 45 |
| Langton's ant, 11,104 and 11,208 | 846 and 858 (+12 per 104 steps) | the highway |
| Turmite A, 8,000 | 4,000 | 4,001 × 4,001 |
| Turmite B, 8,000 | 2,287 | 2 × 1,144 |
| Turmite C, 8,000 | 1,334 | 1,335 × 1,335 |
What the ant does
Chris Langton devised the ant in 1986. It turns right on a white cell and left on a black one, flips the cell, and steps forward. From an empty grid it wanders in a pattern that looks random for about 10,000 steps. Then it settles into a 104-step loop and builds a highway: every time through the loop it moves two cells diagonally and adds twelve black cells. The highway goes on for as long as you let it run.
The loop is not a guess. The 104 steps, the two-cell shift and the twelve cells per loop were checked by running the rule and comparing the walker's moves from one loop to the next. The point where the chaos stops is only approximate here; the 10,000 is the commonly quoted figure.
Dewdney's 1989 Scientific American column gave the more general machines the name turmites. Some people reserve vant for a walker with one state, which would make Langton's ant a vant. The name matters less than the table.
Turmites A, B and C are not known by name. I took them from a search over all two-state, two-colour rules, keeping the ones that left more than 200 black cells in their first 1,500 steps. I chose them for how they grow, not for any claim about them. They grow in a straight strip, a square, and a square again; the checkpoint numbers above are what they do.