A one-dimensional cellular automaton.

| Set rule, an integer in [0, 63]:

This simulates a 1D cellular automaton. Each cell is ON (1) or OFF (0). The initial row is generated randomly and successive rows represent generations that are computed using a rule (numbered from 0 to 63) with the following criteria:

N_x = ∑ -2 ≤ i ≤ +2 . cell(x + i)

N_x is the number of neighbours of x that are ON. The automaton is cyclic -- if the automaton has width W then cell 0's neighbours include cells W-2, W-1, 0, 1 and 2.

Once N_x is computed we use the rule R to determine if cell x is on or off in the next generation:

cell(x) = ((R >> N_x) & 1)

In other words, the rule R = 23 specifies that a cell will be on if 0, 1, 2 or 4 of its neighbours are on in the previous generation.

Values of R that are interesting include 12 and 23. Some values of R reduce to simple patterns very quickly.

NOTE: Monochrome squares in topleft corner represent the active rule. Bright squares indicate a cell will be turned on for 0, 1, 2, 3, 4 and 5 neighbours that are on. Cells flash when state machine is running and do not flash when paused.