Monday, September 21, 2015

Langton's Ant

This two-dimensional, Turing-complete machine running on a square lattice that has a complex, emergent behavior will leave you at the edge of your seat!!





Alongside the many developments in the growing field of computer science, especially with those in the twentieth century, researchers used Turing machines to emulate the behavior of computer logic. These strict, procedural programs were contrasted with research in artificial life, or how computer programs or logical steps could relate to everyday systems and processes. You might have heard of the Game of Life by John Conway, a popular 2D cellular automaton. One of these Turing machines, Langton's ant, is particularly interesting due to its simple set of rules but rather complex and emergent behavior. It is a cellular automaton, or more basically, a grid of black or white cells, that features a hypothetical ant and its movement patterns.

This ant has strict rules to its movement, and starts on one cell facing any direction. Then, depending on the color of the cell that the ant sits on, it can do one of two things, following these rules:

  • If the cell the ant is on is black, the cell changes to a white cell and the ant turns left;
  • If the cell is white, the cell changes to black cell and the ant turns right;
  • The ant then moves forward to the next cell, and repeats the procedure.
The ant in action, in the first few steps.

The rules are straightforward, but starting at a large number of steps, close to 11,000, the ant exhibits a pattern in its movement. It creates what is known as the "highway", a pretty but unexplained piece of its behavior.
The Highway as the ant continues its journey infinitely.

This module has been used to further development and understanding of algorithms, and is a challenge for programmers to create, especially when involving multiple colors, not just a simple "on or off" for each cell. Here is my take on a JavaScript version, which is linked here.


Resources and Videos: