Rule 30
Copied to clipboard
Animation Options
Rule Options
Show / Hide Rules
Randomization Options
Canvas Options
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
Then the next row would have
Controls
Animation Options
- Play - Starts or stops the scrolling. You can also press spacebar to do this.
- Reset - Resets the canvas to the initial state.
- Speed - Controls how fast the canvas scrolls in rows per second.
- Auto-Mutate Rule - Automatically clicks "Mutate" every X rows that are scrolled. Set to 0 to turn off.
- Auto-Randomize Rows - Automatically clicks "Randomize Row" if the bottom row is all the same color
Rule Options
- Randomize Rule - Pick a new random rule
- Mutate Rule - Modify the current rule. The amount it is modified by is controled by "Mutation Amount"
- Flip - Changes the rule to its mirrored version. For example,
becomes - Complement - Changes the rule to its complementary rule. This is the same as replacing each state's color.
For example,
becomes - Cycle - Cycles the output cell of each rule. This is the same clicking on each rule once. For example,
becomes - Also Randomize Colors - If checked, randomizes the colors when clicking "Randomize Rule"
- Mutation Amount - Amount to change the rule when "Mutate" is clicked
- Rule - The currently applied rule, represented as number. See below for specifics
- Initial Row - How to populate the very first row. There's a bunch of options, such as making all the cells
be
, except for the center cell which is , as well as setting the initial row to be a random pattern. - Boundary - How to handle the edges of the image. Options are to wrap around (leftmost and rightmost cells
are considered next to each other), treat as always Off (so the edges are always
) or treat as always On (so the edges are always ). - Show / Hide Rules - Shows or hides the rule diagram, which gives a more detailed view at the current rule
Randomization Options
- Randomize Row - Modifies the bottom row of the canvas while it is scrolling. This can introduce new, interesting patterns to the canvas.
- Chance - Chance to modify a cell
- Randomness Type - How to randomize the bottom row. "Set State X" will randomly change cells to that state. Replace will update every cell to a random state, and cycle will randoly change cells to the next state
- Seed - RNG seed to use when randomizing
Canvas Options
- Randomize Colors - Randomize the colors for each state.
- State 0/1/2 Color - Pick the color for each state. The randomize button next to it can also be used to randomize that particular color.
- Internal Size - The internal size of the canvas. This determines the actual number of cells per row and row many rows to display. Set this lower if you are having performance issues
- External Size - The displayed size of the canvas. This doesn't affect performance
- Lock Internal Size to External Size - Makes the external size and internal size always equal
- Lock External Size to square aspect ration - Makes the width and height for External Size always equal
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 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)