5 minute read
On the cover: Cellular automata
from Chalkdust, Issue 13
by Chalkdust
Matthew Scroggs
Thegame of life—invented by John Conway (see pages56–57) in 1970—is perhaps the most famous cellular automaton. Cellular automata consist of a regular grid of cells (usually squares) that are (usually, see page 38) either ‘on’ or ‘off’. From a given arrangement of cells, the state of each cell in the next generation can be decided by following a set of simple rules. Surprisingly complex patterns can often arise from these simple rules.
Advertisement
While the game of life uses a two-dimensional grid of squares for each generation, the cellular automaton on the cover of this issue of Chalkdust is an elementary cellular automaton: it uses a one-dimensional row of squares for each generation. As each generation is a row, subsequent generations can be shown below previous ones.
Elementary cellular automata
In an elementary cellular automaton, the state of each cell is decided by its state and the state of its two neighbours in the previous generation. An example such rule is shown to the right: in this rule, the a cell will be on in the next generation if it and its two neighbours are on–off–on in the current generation. A cellular automaton is defined by eight of these rules, as there are eight possible states of three cells. 1 0 1
1
An example rule
In 1983, Stephen Wolfram proposed a system for naming elementary cellular automata. If on cells are 1 and off cells are 0, all the possible states of three cells can be written out (starting with 1 1 1 and ending 0 0 0 ). The states given to each middle cell in the next generation gives a sequence of eight ones and zeros, or an eight-digit binary number. Converting this binary number into decimal gives the name of the rule. For example, rule 102 is shown below.
1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0
0 1 1 0 0 1 1 0
Rule 102: so called because (0)1100110 is 102 in binary
Rule 102 is, in fact, the rule that created the pattern shown on the cover of this issue ofChalkdust. To create a pattern like this, first start with a row of squares randomly assigned to be on or off:
1 1 0 1 0 0 0 1 0 1
You can then work along the row, working out whether the cells in the next generation will be on or off. To fill in the end cells, we imagine that the row is surrounded by an infinite sea of zeros.
0 0 1 1
0 1 1 0
1 1 0 1
... and so on until you get the full second generation:
If you continue adding rows, and colour in some of the regions you create, you will eventually get something that looks like the picture to the right.
It’s quite surprising that such simple rules can lead to such an intricate pattern. In some parts, you can see that the same pattern repeats over and over, but in other parts the pattern seems more chaotic.
The pattern gets a square wider each row. This is due to the state 001 being followed by 1: each new 1 from this rule will lead to another 1 that is one square further left.
But just when you think you’re getting used to the pattern of some small and some slightly larger triangles...
Surprise! There’s this huge triangle that appears out of nowhere.
Other rules
Rule 102 is of course not the only rule that defines a cellular automaton: there are 256 different rules in total.
Some of these are particularly boring. For example, in rule 204 each generation is simply a copy of the previous generation. Rule 0 is a particularly dull one too, as after the first generation every cell will be in the off state.
1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0
1 1 0 0 1 1 0 0
Rule 204 is one of the most boring rules as each new cell is a copy of the cell directly above it.
Some other rules are more interesting. For example, rules 30 and 150 make interesting patterns.
100 rows of rules 30 (left) and 150 (right) starting with a row of 100 cells in a random state
If you want to have a go at creating your own cellular automaton picture, you can find a template to fill in on the inside back cover of this issue ofChalkdust. If you’d rather get a computer to do the colouring for you, you can download the Python code I wrote to create the pictures in this article from d github.com/mscroggs/cellular-automata and try some rules out. There are also many ways that you can extend the ideas to create loads of different automata. For example, you could allow each cell to be in one of three states (‘on’, ‘off’, or ‘f’) instead of the two we’ve been allowing. You could then choose a rule assigning one of the three states to each of the 27 possible configurations that three neighbouring three-state cells could be in. But there are 7,625,597,484,987 different automata you could make in this way, so don’t try to draw them all...
Matthew Scroggs Matthew is a postdoctoral researcher at the University of Cambridge. He hasn’t had time to play Klax since the noughties, but he’s pretty sure that Coke is it! d mscroggs.co.uk a @mscroggs r mscroggs
My favourite game Velocity Raptor by TestTubeGames
Jakob Stein An online JavaScript (formerly Flash) game about special relativity, it’s a fun way to wrap your head around geometry that changes as you move. ��/������