<< Go Back

Elementary cellular automaton

Rendered in Python, explained in English

By Dany Shaanan

For simplicity's sake, Elementary cellular automaton is a system of rules to generate a row of black and white pixels out of another. There are 256 such rules, and there is an image for each of them below.

Each image has the same first row of randomly selected pixels, black or white. Each other pixel in the image is determined by the the pixel above it, and the two to the sides of the one above it. If black is 0 and white is 1, then those three pixels, from left to right, could be: 000, 001, 010, 011, 100, 101, 110, 111. We'll refer to these sets as the keys.

Each rule assigns a 'black' or 'white' value to each key. For instance, rule '10000001' assigns 'white' to the first and last keys, and 'black' to all other keys. Hover an image to see its rule. The fact that the first random row, by chance, includes all keys, means that every image here is different, and that by looking at each image, it is possible to deduce the rule that creates it.

Generally, rules with a lot of 1's will have more white, and rules with a lot of 0's will have more black, but more complex patterns might emerge for certain rules.

See the code here