About Langton's Anthill


Langton's Anthill is a 2-dimensional cellular automaton based on Langton's Ant.

Imagine a grid of cells. Every cell on this grid is either on or off (black or white, alive or dead, etc.). Imagine also a little ant walking on the grid. It follows a very simple set of rules while hopping from cell to cell. When it enters a cell it looks at the state of the cell. If the cell is on/black/alive it turns left, if the cell is off/white/dead it turns right and moves one cell forward. The cell the ant just left then switches its state: from on/black/alive to off/white/dead. The ant mindlessly continues to move over the grid, turning according to the state of the cell and switching the cells state by leaving it.

What sounds like a very boring scenario creates very interesting results when you simulate it on a screen. The little red dots that's the ant looks almost alive and the structures it builds too complex to be the result of such a ruleset.

Langton's Anthill is based on the original cellular automaton, but takes it to the next level. While Langton's original Ant moves on a grid where cells have only two states, Ants on Langton's Anthill move on a grid where cells have 255 states (0,1,2,3,4...,255).

Like in the original automaton the ants decision how to turn is based on the state of the current cell. To do so every ant has a ordered list of 255 directions. E.g. ["Left, "Right", "Right", "Left", "Left", "Left",....] Everytime the ant enters a cell, it looks at the current state - maybe 45 - and then looks up the 45th direction in its list, turns and moves forward. The list of directions is called the ants rule.After the ant left the state of the current cell is increased by one.

In the simulation the state of each cell is represendet by a shade of grey (NPI). A cell with the state 0 is white, a cell with the state 255 is black. If a cell hits 255 and gets increased once more, it flips and the current state is then zero again.

What can I do?

By clicking on the screen you can add little tiny ants to the anthill. Every ant that's placed on the anthill has a randomly generated set of rules. Do it as often as you like. A reasonably modern browser should be able to handle 1000 and more ants.

Then just lean back and enjoy the tiny little ants crawling over your screen. Look at how lifelike their movements seem. They build structures that look organic but not random. The build highways between structures and follow them. They meet and seperate. Sometimes they travel together. I even saw them dancing once or twice. It's fascinating yet so simple...

Back to the simulation!