Skip to main content

cellular automata

  • 🔥 advanced
  • 🗂️ transformation
  • ✍️ Gabrielle Partch, Deanna Gelosi

The cellular automata operation takes in a draft as a starting state then iteratively applies an automata rule to the drawdown according to the timestep value.

Example banner

A cellular automaton is a rule applied to a grid over a period of time. The same grid can be read as both a weaving drawdown and as the automata's state on a certain timestep. Each cell in the grid has one of two possible states, represented by a binary value of 0 or 1. These values correspond to both a weaving interlacement and to the two states used in cellular automata. In cellular automata terminology, these two states are conventionally called dead and alive. The operation uses these binary values to determine how each cell changes over successive iterations.

Drawdown cellWeaving structureCellular automata stateBinary value
WhiteWarp lowered; weft passes over warpDead0
BlackWarp raised; weft passes under warpAlive1

The automaton rule describes how the grid changes on successive iterations. For each cell, the rule looks at the states of a set of surrounding cells called the neighborhood. For this implementation, we use the Moore neighborhood which calculates the state of a cell on its next iteration by looking at the values of the cells immediately adjacent and immediately diagonal.

Neighborhood diagram
Figure 1: The Moore neighborhood includes the eight cells around the center cell. The neighborhood is shown outlined in orange. The cells from the grid that are part of the neighborhood have an orange overlay. Note that the out-of-bounds squares of 1s and 0s in fixed live and fixed dead do not have the overlay because they're not part of the original grid.

Automata Rules​

A rule could involve many different ways of parsing the values of neighboring cells, but here we simply sum up all of their values. A white or dead cell is a zero, and a black or live cell is a one, so the sum is the number of living cells in the neighborhood.

The rulestring describes the rule and is separated into two sections delineated by a slash; the first starts with a 'B', which stands for 'born', and the second starts with 'S', which stands for 'survive'. The list of numbers following the 'B' indicates which sum values are required for a cell to be born, and the list of numbers following the 'S' indicates which sum values are required for a cell to survive. For example, consider the rulestring 'B3/S23', which is commonly called Conway's Game of Life. If the cell is currently white, or dead, then the sum must be 3 for the cell to be born or come alive on the next iteration. Likewise, if the cell is currently black, or alive, then the sum must be 2 or 3 for the cell to survive to the next iteration.

Calculation diagram
Figure 2: The calculation of one iteration using Conway's Game of Life rule, B3/S23. The calculations are arranged in the shape of the original grid. Each calculation 'cell' includes a grid showing which position is being calculated, the neighborhood at that position, the sum of the cells in the neighborhood, and the resulting state.

Sample Rulesets​

Rule nameB/S rulestring
2×2B36/S125
34 LifeB34/S34
AmoebaB357/S1358
AssimilationB4567/S345
BacteriaB34/S456
BlinkersB345/S2
BugsB3567/S15678
CoagulationsB378/S235678
CoralB3/S45678
Day and NightB3678/S34678
DiamoebaB35678/S5678
FlakesB3/S12345678
Game of LifeB3/S23
GnarlB1/S1
HighLifeB36/S23
HolsteinB4678/S35678
H-treesB12345678/S1
IceballsB5678/S25678
Land RushB234578/S36
Life Without DeathB12345678/S3
Long LifeB345/S5
MajorityB5678/S45678
MazeB12345/S3
MazectricB3/S1234
MoveB368/S245
Pseudo LifeB357/S238
ReplicatorB1357/S1357
SeedsB2/S
ServiettesB/S234
Slow BlobB367/S125678
StainsB3678/S235678
Walled CitiesB45678/S2345

Troubleshooting Guide​

Having trouble getting the results you want? Start here! Common issues this section aims to address include: blank drafts (automata immediately killed), repeating/ oscillating patterns, and/ or uninteresting patterns.

Cellular automata can produce a variety of results depending on the starting draft and rulestring. Patterns may quickly die out, settle into a stable or repeating state, or fail to develop much variation. These outcomes are not necessarily errors, but may indicate that the starting draft or rulestring could be adjusted.

When experimenting, consider the arrangement and density of live cells in the starting draft. A mixture of live and dead cells, with varied cluster sizes and irregular gaps, and sufficient space to grow can provide more opportunities for patterns to develop. The random, bitfield, waffle-ish, and sierpinski square structures tend to work well.

The rulestring is another way to influence how patterns develop. Its two parts control different aspects of cell behavior: the values after 'B' determine when dead cells become alive, while the values after 'S' determine when live cells remain alive. Adding values to either part allows cells to change or persist under a wider range of neighborhood conditions, while removing values makes those conditions more restrictive. Experiment with different combinations of birth and survival values to see how they affect the patterns that emerge. The example rulestrings can be a useful starting point for exploring different behaviors.

The edge wrapping mode can also influence pattern development, particularly near the boundaries of the draft. If patterns are being restricted or behaving unexpectedly at the edges, try switching between wrapped, fixed live, and fixed dead modes to see how different boundary conditions affect the results.

Parameters​

  • timestep: the number of iterations that the rule defined by the rulestring is applied.
  • edge wrapping mode: determines what value is used for cells that are outside the draft, the edge-cases, when calculating the next iteration. Wrapped will use the cell value on the opposite side of the grid, fixed live will always use a live value (1), and fixed dead will always use a dead value (0).
  • rulestring: the rule that is applied to the grid on each timestep to calculate the next generation. The rule should be in birth/survival notation using the Moore neighborhood, eg listed values of no more than 9.

Application​

This operation can be used to generate different variations of an input draft, forming intricate geometric patterns that have lifelike behavior over time.

Developer​

adacad id: cellular_automata

packages/adacad-drafting-lib/src/operations/cellular_automata/cellular_automata.ts
loading...