Langton’s Ant is a cellular automaton that models an ant moving on a grid of cells following some very basic rules.
At the start of the simulation, the ant is randomly positioned on a 2D-grid of white cells. The ant is also given a direction (either facing up, down, left or right).
The ant then moves according to the colour of the cell it is currently sitting in, with the following rules:
1.If the cell is white, it changes to black and the ant turns right 90°.
2.If the cell is black, it changes to white and the ant turns left 90°.
3.The ant then moves forward to the next cell, and repeat from step 1.
These simple rules lead to complex behaviours. Three distinct modes of behaviour are apparent, when starting on a completely white grid:
- Simplicity: During the first few hundred moves it creates very simple patterns which are often symmetric.
- Chaos: After a few hundred moves, a big, irregular pattern of black and white squares appears. The ant traces a pseudo-random path until around 10,000 steps.
- Emergent order: Finally the ant starts building a recurrent “highway” pattern of 104 steps that repeats indefinitely.
All finite initial configurations tested eventually converge to the same repetitive pattern, suggesting that the “highway” is an attractor of Langton’s ant, but no one has been able to prove that this is true for all such initial configurations.