For this exercise, you are tasked with creating a linear cellular automaton*. A cellular automaton consists of a grid of cells, with each row being called a generation. Each cell is in a certain state, which is ‘occupied’ or ‘empty’ in this case. The content of each subsequent generation is changed from the previous generation according to a few simple rules.
The rules for computing a new generation satisfy four requirements:
- The rules use only the current generation to compute the next one.
- The rules define one state value per cell.
- The rules are the same for each cell.
- The rules define the new state value based on the state values in a set of cells in fixed positions with respect to the cell the value is computed for; such a set is often referred to as the neighborhood of the cell.
This exercise concerns linear cellular automata, i.e., automata with a one-dimensional array of cells as grid. The neighborhood of a cell consists of the immediate neighbors in the array and the cell itself. Again, there are only two different states, referred to as ‘occupied’ and ‘empty’ (i.e., not occupied). In the book “A new kind of science” by Stephen Wolfram, the creator of the Mathematica tool, shows that such simple automata can display very interesting behavior. This exercise will show the effect of some rules.