An ant (the red square) walks on a grid of colored cells. At each step it looks at the color under it, turns, recolors the cell, and steps forward. Langton's ant is the simplest case: on a blank cell it turns right, on a colored one left, and flips the cell. For about ten thousand steps it makes what looks like chaos, then suddenly starts building a diagonal highway that never ends. Press Play to watch it, pick another rule, or type your own. A turmite is the same ant with a memory: a table says, for each pair of (inner state, color under it), what color to leave, which way to turn, and what state to be in next.
Chris Langton described the ant in 1986. Nobody has proved that the highway always appears, only that it does from every starting pattern tried. A rule of just L and R letters is the ant on more colors: each letter says which way to turn on that color, and the cell then moves on to the next color in the list, so RL is the classic ant and LLRR or LRRRRRLLR grow very different shapes. The longer form handles inner states: one group per ant state, separated by slashes, and one three-character entry per cell color inside it, giving the new color, the turn (L, R, U for turn around, N for no turn) and the new state, as in 1R0 0L0, which is also the classic ant. An entry that points at a color or state that does not exist turns the box red. Random tries two-state, three-color tables and keeps one that, after 20,000 trial steps, has grown an irregular pattern without running off in a straight line. Turmites A, B and C came from that search; they are not named in the literature. The descriptions of the L/R presets are what I measured at 100,000 steps. The grid wraps around at the edges.
With more than one ant (Fractint's ant type allowed up to 256) they share one grid and move one after the other every step, so each sees what the ones before it did to the cell. From the middle they start identical and part ways only because of that; from random places and headings they wander separately until their trails meet, and then a highway can be torn apart by another ant crossing it.
Ant type 2 is Fractint's second ant. It ignores the color of its cell: a cell is empty or holds the number of the ant that last painted it, and a bit pattern decides the turns. A marker bit moves up one place every step (32 places, then round again); if the rule has a 1 there the ant turns right and empties the cell, otherwise it turns left and paints the cell with its own number. A cell another ant painted is read through that ant's rule. Type the rule as 1s and 0s (or R and L); leave it empty for a random rule for every ant, which with several ants at random places gives long highways and tangles. The rule is read from its last character to its first as the marker moves, and our turns are mirrored from Fractint's.
This page was created with Claude Code.