# Elementary Cellular Automata

Cellular automata are simple models of computation that often demonstrate complex emergent behavior. This behavior can be used to model many types of phenomena in the physical world.

Elementary cellular automata are the simplest class of one-dimensional cellular automata (vs something like the Game Of Life which is a two-dimensional cellular automaton.)

## How it Works

The first generation of every elementary cellular automaton is the same: a single alive (black) cell with an infinite number of dead (white) cells flanking it:

The state of each cell in subsequent generations is based on its state and the state of its two neighbors in the previous generation. For example, in the second generation the state of the left-most cell above is based on its state in the first generation (dead) and the state of its two neighbors (dead and dead). The state of the single alive cell is based on its state in the first generation (alive) and the state of its two neighbors (dead an dead).

Because each cell is based on three values (the state of its left neighbor in the last generation, the state of itself in the last generation, and the state of its right number in the last generation) and because each of those states have two possible values (dead or alive) there are 2^{3} = 8 possible combinations that a cell's state can be based on:

- Alive-alive-alive
- Alive-alive-dead
- Alive-dead-alive
- Alive-dead-dead
- Dead-alive-alive
- Dead-alive-dead
- Dead-dead-alive
- Dead-dead-dead

The *rules* determine how each of these combinations impact the state of a cell in the next generation.

For each of the 8 combinations, we can say that that combination makes the state of the cell in the next generation alive or we can say that it makes it dead (2 possibilities). Therefore, there are 2^{8} = 256 possible rules that can govern a cellular automaton.

Rule 30, for example, corresponds to 00011110 in binary. Those 8 bits represent what impact the 8 possible states have on the next cell ^{1}.

When a cell's left neighbor, itself, and its right neighbor are all alive in the previous generation, rule 30 says that the cell's state in the next generation should be dead. When a cell's left neighbor is alive, itself is alive, and its right neighbor is dead, that cell's state in the next generation should be dead. And so on.

To make it easier to visualize how the rules affect the cellular automaton over time, we can each stack generation on top of each other to so that you can see what impact the rule has. Here are the first five generations of Rule 30:

This Emergent Mind project lets you explore the impact of all 256 possible rules on future generations of the cellular automaton.

To learn more, check out the Wikipedia page, Wolfam Alpha's tutorial on Elementary Cellular Automaton, or Wolfam's A New Kind of Science.

^{1} Image via Wolfram Alpha.