What Is It With the Ants?

I got the idea for the Langton’s Ants experiment from Kevin Lindsey’s experiment . The code is my own, but the results were carefully double-checked against the original.

The “ant” follows four rules:

The ant toggles the color of its current square
The ant advances in the direction it is facing
If the new square is off, then the ant turns to the right by 90 degrees
If the new square is on, then the ant turns to the left by 90 degrees

Possible future riffs on this idea include multiple ants, multiple colors, and a hex/octal grid.


I had a productive evening yesterday playing around with Cellular Automata, in response to Stephen Wolfram’s magnum opus A New Kind of Science . I put together a CA generator which calculates 90 generations of a 60-cell grid. That’s 5400 cells. So when you click this here link , wait for a few seconds (around four on my monster PC) for the thing to finish crunching. It shouldn’t crush your computer, although I have not looked at it on a Macintosh. The blank right half of the file is where the (self explanatory) controls will go in the next iteration of the thing. It still has a few bugs which won’t be obvious unless you know what the thing is doing.

I will post the code when I am happy with it.

This evening I got all set up to start playing in Java. I will maybe have a more powerful version of the CA demo up in a couple of months.