Rule 30

Copied to clipboard

Animation Options

Rule Options


Show / Hide Rules

Randomization Options

Canvas Options

x x

Permalink

Introduction

Rule 30 is a toy for exploring 1D cellular automata. It simulates a 3-state cellular automata. Each pixel of the canvas on the left represents a "cell". The color of the cell is determined by the three cells above it (the cell immediately above it, the cell above and to the left, and the cel above and to the right).

Assuming you are using the default settings, the first row will be look something like this:

The next row is then computed by looking at groups of 3 cells in the first row. For example, we see that the middle cell in the next row would have on the left, in the center, and on the right. From this, we would look up the appropriate rule in the rules diagram on the right. Let's say it's this:

Then the next row would have in the center. This process repeats for every cell in the next row, and then every cell in the row after that, and so on, until the whole canvas is filled up.

Controls

Animation Options

Rule Options

Randomization Options

Canvas Options

Other Controls

You can click the canvas to take a screenshot of the current image on the canvas. This is saved to your clipboard.

You can use the left and right arrow keys to go back to a previous rule. The history only goes back 100 steps.

How the Rule Number Works

In the elementary cellular automaton, each cell has only two states, on or off and the next cell in a row is computed by looking at the above 3 cells. Hence, this give rise to 256 different rules. Normally, the rules are numbered so that when a rule's number is written out in binary, each bit in the number corresponds to whether or not a given shape of cells makes the cell in the next row turn on or off. For example, Rule 30 in binary is 0 0 0 1 1 1 1 0. This matches up to how it's rules are defined (Here, 0 means and 1 means ):

For this toy, we have 3 states, so instead of binary, we write out the number in trinary (base-3). Since there's 3 input cells, each with 3 possible options, there will be 3*3*3 = 27 trinary digits for our rule number. That means there 3^27 = 7,625,597,484,987 possible rules!

This is also why the default rule number is 19,794 instead of 30 (it's the equivalent rule where we just ignore the 3rd state. Well, technically there's millions of similar such rules, but 19,794 is the smallest of these numerically)