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.

Leave a Reply

Your email address will not be published. Required fields are marked *