Cellular Automata¶
A cellular automaton is a model of a system of "cell" objects with the following characteristics:
- The cells live on a grid.
- Each cell has a state.
- Each cell has a neighborhood, which affects the cell's state.
Elementary Cellular Automata¶
This is a 1-dimensional cellular automaton where the grid is a simple array, the state is either 1 or 0, and the neighborhood is the cell itself plus the cells to its left and right.
- Three neighbors, each with two states, means we can represent the neighborhood state in binary from
0b000to0b111. There are 8 possibilities in total. - To find the new state for a cell based on its neighborhood's state, we need to map each neighborhood state to a new state. We can do this with a set of 8 bits, like
0b11111111. Since 8 bits can represent numbers from 0 to 255, the rulesets for elementary cellular automata are usually represented by a number.
How to deal with edges?¶
Usually three ways:
- Edges remain constant. In my implementation, everything outside the bounds is constant.
- Edges wrap around. This effectively simulates an infinite grid.
- Edges have different neighborhoods and rules.
Classification¶
- Class 1: Uniformity. Every cell becomes black. Rule:
222 - Class 2: Repetition. Cells oscillate in regular patterns. Rule:
190 - Class 3: Random. Chaotic and random patterns. (Can be used for random number generation!). Rule:
30 - Class 4: Complexity. A mixture of class 2 and 3. Rules:
110
Game of Life¶
Rules¶
- Death
- Overpopulation: A living cell with four or more live neighbors dies.
- Loneliness: A living cell with one or fewer live neighbors dies.
- Birth: A dead cell with exactly three live neighbors becomes a live cell.
- Stasis:
- Staying alive: A living cell with two or three live neighbors stays alive.
- Staying dead: A dead cell with any number of neighbors other than three stays dead.
Variations¶
- Non-rectangular grids. Hexagonal grids, for example.
- Probabilistic. What if both death and birth only occur with a certain probability?
- Continuous. What if a cell's state is no longer binary, but a floating-point number?
- Image Processing. Some image processing algorithms, like blurring or simulating ink dispersion and water ripples, can be achieved with CA rules.
- Historical. What if a cell's behavior is affected by its duration of life? This relates to a "complex adaptive system".
- Moving cells. What if cells could move?
- Nesting. A complex system nested in another complex system? Sounds fun. Countries of cities of neighborhoods of families of individuals.
References¶
- Stanisław Ulam and John von Neumann's work
- Stephen Wolfram's A New Kind of Science
- Martin Gardner's article on John Conway's Game of Life
- Exploring Emergence by Mitchell Resnick and Brian Silverman, Lifelong Kindergarten Group, MIT Media Laboratory