Patterns / Computation / Small experiments
One instruction away
Change one letter in an ant’s rule and a homecoming can become a highway. A little rulebook to explore.
LLRR and LLRL are only one instruction apart. From the same blank start, one keeps coming home while the other eventually heads out along a road.
After the first ant experiment, I wanted to compare neighbouring rules. More instructions give us more colour states, but the pictures need not become more intricate in any straightforward order.
A small rulebook
Choose a rule, or write two to eight letters of your own. Each letter gives the turn for one colour state: L is left; R is right. A visited square advances to the next state, cycling back to state 0 after the last. Every reset begins on uniform state 0, facing north.
Static comparison shown. Enable JavaScript to explore the rules interactively.
States 0 and 1 turn left; states 2 and 3 turn right.
Applying a rule resets the picture. Jump selects a useful checkpoint, not a promised highway. View fits automatically; red marks the ant and a ring marks home. Grid does not wrap. Starts paused and pauses when hidden; browser limit 300,000 moves.
The neighbouring pair
Try LLRR, jump to 100,000 moves, and watch the homecoming counter. Then choose LLRL and jump to 260,000. In this run the latter has begun a diagonal highway. This is why the playground permits more moves than the first demonstration: stopping at 100,000 would hide that change.
In my separate calculations at 300,000 moves, LLRR had returned home 7,177 times and LLRL 76 times. These are properties of these particular blank-start runs. They are not measurements of how often either behaviour occurs across different initial pictures.

More letters, a shorter rhythm
I also measured repeated colour-reading sequences in the last 10,000 moves of several runs. The smallest matching periods I found, searching from 1 to 512 moves, were:
| Rule | States | Tail period |
|---|---|---|
| LR | 2 | 104 |
| LLR | 3 | 18 |
| LLLR | 4 | 52 |
| LLRL | 4 | 384 |
These finite-tail measurements do not prove endless repetition. The patterns agree with examples discussed in Gajardo, Lutfalla, and Rao’s 2024 paper, Ants on the highway. Its discussion of rare outcomes also cautions against treating a short catalogue as an exhaustive map of possibilities.
Different colours, the same walk
Try LR and then LRLR. The second has four colour states, but its turns still alternate left, right, left, right as each square is revisited. Reducing those four state numbers modulo two recovers the first rule. Starting both on state 0 therefore gives the same ant positions and directions, despite the extra colours. I checked this move by move for 10,000 steps.
Even rotating a rule’s letters needs care. LLR and LRL on state-0 backgrounds diverged at move five in my check. If I also relabelled the whole starting background to state 2 for LRL, their paths matched. The initial colour is part of the experiment.
A finite catalogue
I ran 57 rules of lengths two to six for a million moves each, retaining words beginning with L and containing R. Complementing every turn gives a mirrored counterpart; I did not discard rotations. Ten runs had a matching colour-reading tail period within the search range. For the others, all I can say from this check is “not detected at this cutoff”. That does not establish chaos or aperiodicity.
The original measurements are available as comparison data (JSON). The browser’s movement rules are also inspectable. The displayed palette, viewpoint, and jump positions are presentation choices; the walker always follows the chosen word.
I started by looking for a ladder of increasing complexity. What seems more interesting is a neighbourhood: small edits can take us to very different places, and some apparently different instructions describe the same journey.
A question, a correction, or a connection of your own?
I’d be glad to hear it.