Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rule notation

Every automaton in JETCARP has a rule, written as a short piece of text such as B3/S23 or Cyclic 14/1. The same text works everywhere: in the app’s rule box, in a scene file, on the command line, in scripts and in the MCP tools. This page lists every form the parser accepts, with its limits. The encyclopedia page for each family explains what the rules mean; this page only says how to write them.

A few things hold for every form:

  • Case does not matter, and spaces are ignored except where they separate words (HexT3 sum 588). b3/s23, B3/S23 and B3 / S23 are the same rule.
  • JETCARP writes rules back in one canonical form. A saved scene, a report or the app shows the canonical text, so Rule 30 comes back as W30 and B2/S/3 as B2/S/C3. The table at the end of this page shows what each example becomes.
  • Names are resolved by the front ends, not by scene files. The app, the command line, scripts and the MCP tools accept a rule’s name (Life, Brian's Brain) wherever they accept notation. A scene file’s rule field must hold notation; a name there is refused with “‘Life’ is not a rule”. See Named rules.
  • Some rules need a particular grid. Elementary rules, Margolus block rules and von Neumann’s 29-state rule need the square grid, the two-parent hexagon rules the hex grid and the three-parent ones the flat-top hex_flat grid. Everything else runs on any tiling. A rule that cannot run on the chosen tiling is refused with a message that says which grid it needs.
FamilyExamplePage
Life-like (birth/survival)B3/S23, B3/S23V, B3,10/S2,3Life-like rules
GenerationsB2/S/C3Generations
Larger than LifeR5,C2,S33-57,B34-45Larger than Life
ElementaryW30, Rule 30Elementary rules
Hexagonal rowsHexW 6, HexT3 sum 588HexW and HexT
LayeredLayer 2/01Layered rules
JACAJACA +B3/S23 -B36/S23 blast 2JACA
Ants and turmitesAnt RL, Turmite 1R1,1L0/1R1,0N0Langton’s ant and turmites
WireWorldWireWorldWireWorld
Cyclic, Greenberg–Hastings, rock-paper-scissorsCyclic 16/1, GH 3/1, RPS 3/3Cyclic rules
Hodgepodge, forest fireHodgepodge 200/3/3/28, ForestFire 0.01/0.0001Hodgepodge and forest fire
Margolus block rulesMargolus BBMMargolus block rules
LeniaLenia R=13,T=10,b=1,m=0.15,s=0.015Lenia
Abelian sandpileSandpileThe Abelian sandpile
Von Neumann’s 29 statesJvN29Von Neumann’s automaton
Priority tablesSpectreGlider, Priority 4: …Priority rules
Rule tablesTable parityRule tables

Life-like rules: B/S

B<birth counts>/S<survival counts>. A dead cell with a birth count of live neighbours is born; a live cell with a survival count survives. Either list may be empty (B2/S is Seeds). The counts may be written in any order and are sorted when written back (B32/S2 becomes B23/S2).

FormMeaning
B3/S23Touch neighbours (the default)
B3/S23VA trailing V picks edge neighbours, as on LifeWiki
B2/S34HA trailing H is accepted and ignored: it records that a rule was meant for hexagons, and the tiling decides what the rule runs on
B3,10/S2,3Commas separate the counts as soon as one of them is 10 or more; counts up to 31 are allowed
B10,/S2A single count above 9 keeps a trailing comma, so it does not read as 1 and 0
B014/S2Birth on 0 is allowed (see B0 rules)

Only the birth-first order, with its letters, is read: the older survival/birth forms 23/3 and S23/B3 are refused.

Generations

B<birth>/S<survival>/C<states>, with 2 to 255 states. The third part may also be written without the C (B2/S/3) or with a G (B2/S/G3); JETCARP writes it with C. With two states the rule is an ordinary B/S rule (B3/S23/C2 is B3/S23). A trailing V picks edge neighbours (B2/S/C3V).

Larger than Life

Two forms, both with fields separated by commas:

FormMeaning
R5,C2,S33-57,B34-45HROT form: range R, states C, survival S and birth B counts. The cell itself is not counted
R5,C0,M1,S34..58,B34..45,NMMCell’s form: M1 counts the cell itself, so survival bounds are one higher; JETCARP converts it to the HROT form
…,NM, …,NN, …,N+Neighbourhood: Moore (the default; within R steps over touch neighbours), von Neumann (within R steps over edge neighbours) or the cross (square grid only)

The range runs from 1 to 20. C0 and C2 both mean two states; up to C255 gives Generations-style decay. Counts can be single values, ranges written a-b or a..b, or lists of both separated by commas (S2-3,5,7-9). Weighted and custom neighbourhoods (NW… and other N suffixes) are not supported yet, so a few named rules from other programs, such as Coexistence, cannot be run.

Elementary rules

W<n> or Rule <n>, with n from 0 to 255 (Rule110 and W 30 also work). They need the square grid and write one row per generation.

Hexagonal row rules: HexW and HexT

FormGridNumbers
HexW n (also HexW2 n)hextwo parents, 2 states: 0 to 15
HexW3 nhextwo parents, 3 states: 0 to 19,682
HexT n (also HexT2 n)hex_flatthree parents, 2 states: 0 to 255
HexT sum nhex_flatthree parents, 2 states, totalistic: 0 to 15
HexT sym nhex_flatthree parents, 2 states, left-right symmetric: 0 to 63
HexT3 nhex_flatthree parents, 3 states: 0 to 327 − 1
HexT3 sum nhex_flatthree parents, 3 states, totalistic: 0 to 2,186
HexT3 sym nhex_flatthree parents, 3 states, symmetric: 0 to 318 − 1

How a number is read (which digit belongs to which parents) is on the hexagonal rows page.

Layered rules

Layer <states>/<outputs> (also Layered), with 2 to 9 states and 1 to 64 output digits. Digit k is the new state of a tile whose parents’ states add up to k; the list repeats for larger sums. Every digit must be a state below the state count, so Layer 2/02 is refused. Layered rules run on any tiling.

JACA

JACA <rule for +1> [<rule for −1>] [blast <r>], where each rule is a B/S rule.

FormMeaning
JACA B3/S23Both signs follow the same rule
JACA +B3/S23 -B36/S23+1 follows the first rule, −1 the second
JACA B3/S23 -B36/S23The signs are optional: the first rule is +1’s, the second −1’s
JACA B3/S23 blast 2Each annihilation also clears every cell within 2 steps; blast=2 and x2 mean the same
JACA B13/S234VA V on a B/S part picks edge neighbours

The blast radius runs from 0 to 64. Rules with birth on 0 are refused. Counts of 10 or more use commas, as in other B/S rules.

Ants and turmites

FormMeaning
Ant RL, Ant, Ant: RLLangton’s ant (Ant alone is RL)
Turmite LLRRA turn string: on a tile of colour c, turn by letter c and repaint it c + 1
Turmite RL2NUTurns for hexagons: R2 and L2 turn two slots, N not at all, U back
Turmite 1R1,1L0/1R1,0N0A table: one group per state, separated by /, one entry per colour, separated by ,

Turns are L, R, N (none), U (half the tile’s degree) and L2 and R2 (two slots); L1 and R1 are the same as L and R. A turn string has 2 to 16 turns. A table entry is <colour to write><turn><next state>; tables have up to 16 states and 2 to 16 colours, with 10 to 15 written a to f, and every state must have one entry per colour. Ants always walk across edges, whatever neighbourhood is set. How a turn is measured on tiles that are not squares is on the turmites page.

Multi-state families with parameters

Parameters follow the name, separated by slashes. Each name alone gives the defaults shown.

FormParametersDefaultLimits
Cyclic s/tstates, thresholdCyclic 16/12 to 255 states; threshold 1 to 32
GH s/t (also Greenberg-Hastings)states, thresholdGH 3/13 to 255 states; threshold 1 to 32
RPS s/tspecies, thresholdRPS 3/32 to 255 species; threshold 1 to 32
ForestFire p/f (also Forest)growth and lightning probabilitiesForestFire 0.01/0.0001each 0 to 1
Hodgepodge n/k1/k2/gn, k1, k2, gHodgepodge 200/3/3/28n 2 to 254; k1, k2 1 to 1,000; g 0 to 1,000

The cyclic automaton uses edge neighbours by default; the others use touch neighbours.

Margolus block rules

FormMeaning
Margolus 0,8,4,3,2,5,9,7,1,6,10,11,12,13,14,15The new state of a 2 × 2 block for each block state 0 to 15 (commas or semicolons)
MS,D0;8;4;3;2;5;9;7;1;6;10;11;12;13;14;15MCell’s form of the same table
Margolus BBM, Margolus Critters, Margolus Tron, Margolus SingleRotation, Margolus HPPThe built-in tables by name (BilliardBall also works for BBM)

Blocks number their cells as MCell does: upper left 1, upper right 2, lower left 4, lower right 8. Named tables are written back as their 16 outputs. Margolus rules need the square grid.

Lenia

Lenia R=…,T=…,b=…,m=…,s=… with optional kn=… and gn=…. Parameters may come in any order, may be fractions (b=1/2,1), and Chan’s bracketed lists (b=[1/2,1]) are read too. Lenia alone is Orbium’s rule, Lenia R=13,T=10,b=1,m=0.15,s=0.015.

ParameterLimits
R, kernel radius in cells1 to 64
T, time resolution1 to 10,000
b, kernel peaks1 to 8 values from 0 to 1
m, s, growth centre and widths above 0
kn, kernel core1 to 4 (default 1)
gn, growth function1 to 3 (default 1)

Priority tables

Priority <states>: <row>; <row>; … (PT is accepted for Priority), with 2 to 8 states and at most 64 rows. A row is <own state>|<conditions>-><next state>: the own state is a number or * for any, and the conditions are terms nS>=m (“at least m neighbours in state S”) joined by &, or always. The first row that matches wins; a cell that matches none becomes 0.

SpectreGlider (also table:spectre-glider) is James Edmond’s Spectre glider rule, the three-row table Priority 4: 0|n0>=3&n1>=1->3; 3|n3>=3->0; 3|n1>=1->1. See Priority rules and the Spectre glider.

Rule tables

Table <name> runs a rule table by name (the name is not case sensitive). One table is built in, Table parity. Other tables come from the scene’s own tables list (see the scene file format) or are loaded in the app; a name that no table has is refused when the automaton is added (“no rule table named ‘codd’”). The table format itself is on the rule tables page.

Single-word rules

FormAlso accepted
WireWorldWire World
SandpileAbelian Sandpile
JvN29JvN, VonNeumann29, VonNeumann
SpectreGlidertable:spectre-glider

Named rules

Where the front ends take a rule (the app, jetcarp commands, scripts and the MCP tools), they also take a rule’s name. Names are compared by their letters and digits only, in any case, so Brian's Brain, brians-brain and BRIANS BRAIN are one name, and Game of Life, Conway and Conway's Life are nicknames for Life. Text that is already valid notation is always read as notation first. jetcarp rules lists every name with its notation; the named rule catalogue has them all with their credits.

Scene files, again, store notation only: the app and jetcarp run --save write the notation, and the scene’s automaton keeps the name in its own name field.

Neighbourhoods

Rules that count neighbours run on touch or edge neighbours (see How JETCARP generalises automata). The notation can choose (V on a B/S, Generations or JACA rule; NM, NN and N+ on Larger than Life); otherwise an automaton’s neighborhood setting does, and the rule’s default applies when neither does. In a scene file the setting is "touch" or "edge". The command-line --nb options, script options and MCP tools also accept other names, in any case and with - or a space in place of _: moore, touching, corner, vertex, t or 8 for touch, and von_neumann, vonneumann, vn, e or 4 for edge. Ants, elementary and hexagonal row rules, Margolus rules, Lenia, Larger than Life and von Neumann’s rule fix their own neighbourhood, and the setting is ignored for them.

Checked against the program

Every example on this page was parsed by JETCARP 0.4.0 through jetcarp api call world.new (each on a tiling it can run on), and the refusals were checked to fail with the messages quoted. The neighbourhood names are covered by JETCARP’s unit tests, and moore, von-neumann and a refused hex were also tried on jetcarp search census --nb; the scene-file cases were run with jetcarp run. This table shows what JETCARP writes back for the examples whose canonical form differs from what was typed:

TypedWritten back
b3/s23B3/S23 (named Life)
B2/S34HB2/S34
B32/S2B23/S2
B3,10/S2,3B3,10/S23
B2/S/3, B2/S/G3B2/S/C3 (named Brian’s Brain)
B3/S23/C2B3/S23
R5,C0,M1,S34..58,B34..45,NMR5,C2,S33-57,B34-45 (named Bosco’s Rule)
Rule 30, Rule110, W 30W30, W110, W30
HexW2 6, HexT2 30HexW 6, HexT 30
Layered 2/0110Layer 2/0110
JACA B3/S23 -B36/S23JACA +B3/S23 -B36/S23
JACA B3/S23 blast=2, JACA B3/S23 x2JACA B3/S23 blast 2
Ant, Ant: RL, Turmite R1L1Ant RL (named Langton’s ant)
Cyclic, GH, RPS, ForestFire, HodgepodgeCyclic 16/1, GH 3/1, RPS 3/3, ForestFire 0.01/0.0001, Hodgepodge 200/3/3/28
Margolus BBM, Margolus BilliardBall, MS,D0;8;4;…Margolus 0,8,4,3,2,5,9,7,1,6,10,11,12,13,14,15
Lenia, Lenia R=13,T=10,b=[1/2,1],m=0.15,s=0.015Lenia R=13,T=10,b=1,m=0.15,s=0.015, Lenia R=13,T=10,b=1/2,1,m=0.15,s=0.015
PT 4: 0|n0>=3&n1>=1->3Priority 4: 0|n0>=3&n1>=1->3
table:spectre-gliderSpectreGlider
JvN, VonNeumann29JvN29
Abelian Sandpile, wire worldSandpile, WireWorld
Life, Game of Life, ConwayB3/S23
Brian's Brain, brians-brainB2/S/C3
Gnarl (von Neumann)B1/S0V
CrittersMargolus 15,14,13,3,11,5,6,1,7,9,10,2,12,4,8,0
Rule 184 (a name)W184

Refused as expected: 23/3, S23/B3, W256, HexT 256, HexT sym 64, Layer 2/02, JACA B03/S23, JACA … blast 65, B2/S/C1, B2/S/C256, R21,…, …,NW0010, R3,C2,S2,B3,N+ on hexagons, Lenia R=65, Priority 9: …, Table codd, Cyclic 1/1, Hodgepodge 255/3/3/28, an incomplete turmite table, W30, Margolus BBM and JvN29 off the square grid, HexW 6 off hex, HexT 30 off hex_flat, the name Coexistence, and a name in a scene file.