Your Mission: Make Cells Come Alive

There are many named cellular automata. You’ll see elementary cellular automata in the next chapter. These operate on one-dimensional rows. You can build CAs in two or more dimensions. Christopher Langton, an artificial life researcher, developed a two-dimensional automaton. Langton’s CA has an artificial ant on a grid. The ant walks around, coloring squares as it moves. The ant moves forward to one of the four neighboring squares: left, right, up, or down. Two rules govern the ant’s behavior:

  • On a white square, turn clockwise.
  • On a black square, turn counter-clockwise.

In either case, it flips the color of the current square and steps forward.

You tend to see three things happen in this CA. First, the ant ...

Get Genetic Algorithms and Machine Learning for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.