Format:
expression:state;
expression:state;
expression:state;
Any valid JavaScript expression will work, either arithmetic or logical.
Available variables:
- cell <Integer> - State of cell (0/1).
- liveNeighbours <Integer> - Number of neighbours with state=1 (0-8).
- adjacentNeighbours <Integer> - Number of adjacent neighbours (up, down, left, right) with state=1 (0-4).
- diagonalNeighbours <Integer> - Number of diagonal neighbours (top left, top right, bottom left, bottom right) with state=1 (0-4).
- neighbours[8] Array<Integer> - State of specified neighbour. Indexing (0-7) starts at top left neighbour (0) and goes clockwise.
Example:
cell === 1 && liveNeighours >= 4 : 0;
liveNeighours >= 4 || liveNeighbours === 6 : 0;
You can even change the ruleset while the simulation is running and see how it gets affected.