Rule integer

From LifeWiki
Jump to: navigation, search

The rule integer of a given totalistic Life-like cellular automaton is a single integer expressing its birth and survival conditions.

The rule integer is computed by iterating over all B and S conditions, in order, writing down a one if a condition is present and a zero otherwise, and finally reversing the resulting string and interpreting it as a binary number. For instance, for Conway's Game of Life (B3/S23):

B0 B1 B2 B3 B4 B5 B6 B7 B8 S0 S1 S2 S3 S4 S5 S6 S7 S8
 0  0  0  1  0  0  0  0  0  0  0  1  1  0  0  0  0  0 = 000100000001100000
000100000001100000 => 000001100000001000b = 6152d

apgsearch 3.x (apgmera) uses a variant of rule integers to determine the circuitry needed to compute a given rule.

Non-totalistic rules

There is no generally accepted way of assigning rule integers or numbers to non-totalistic Life-like cellular automata. However, a candidate assignment is used by Chris Rowett's LifeViewer and will be added to Golly 2.9 as a native rule type: rule = MAP {base64-encoded 512-bit binary string}, where the Nth bit in the string gives the output state for a specific set of neighborhood conditions.

Numbering the bits starting with 0, bit #0 (&B000000000) is the output state if all neighbors (and the center cell) are OFF, and bit #511 (&B111111111) is the output state if all neighbors (and the center cell) are ON. In between, look up the value of the various ON cells in a neighborhood in the following table:

1 2 4
8 16 32
64 128 256

The output state is read directly from the 512-bit string, The position in the string is determined by the sum of the values of the ON cells. For example, zero-based bit#85 (=1+4+16+64) specifies what happens to an ON cell if it has ON neighbors to the NW, NE, and SW.

Megacell non-totalistic encoding

Adam P. Goucher's megacell is a Life unit cell capable of simulating arbitrary non-totalistic rules. Its configuration includes a 512-bit rule integer encoded as a line of eaters in the west side of the south corner. This uses a different bit order, with the center cell as the most significant bit:

4 2 1
8 256 128
16 32 64