Discrete Dynamics Lab

DD-Life and complex dynamics in multi-value DDLab

Examples of "Life"-like Cellular Automata, and other types of complex dynamics, with value range v=3 and nearest neighbors, on a hex, square and cubic lattice. Click images to enlarge.

return to: DDLab home - update summary - Multi-Value - Self-reproduction

DD-Life (with 3 values) are families of "Life"-like 2d and 3d CA rules, on a hexagonal, square and cubic lattice. The rules are k-totalistic (kcode). Though most kcode rules result in disordered behavior, there are a surprising minority that self-organize random patterns into a variety of complex interacting/propagating structures: gliders, gliders-guns, self-replication, spirals and predator-prey dynamics. Mutants of these complex rules are very often complex themselves, making families of related rules. For more info and instructions on how to run (and mutate) these rules see below.

I found these examples while experimenting with the "k-totalistic" rules, where the lookup table depends just on the totals of each value in the neighborhood. Complex dynamics like this can be found automatically by my method of classifying rule space, described for 1d in "Classifying Cellular Automata Automatically: Finding gliders, filtering, and relating space-time patterns, attractor basins, and the Z parameter". To see this paper click here for publications.
I am indebted to Antonio Lafusa (alafusa@tiscalinet.it) for introducing me to this class of rule, see his paper for Alife8 which describes similar complex 2d k-totalistic rules found by genetic algorithm (Bilotta, Lafusa, Pantano, "Is self-replication an embedded characteristic of the artificial/living matter?").


Hex k=6 n=100x120 Hex k=7 n=100x120
panel 1. panel 2. panel 3. panel 4.
k=6 kcode=2121022002022021221222211202 (v3k6s1.vco) k=7 k=7 kcode=212102200202202112122212120222210202 (v3k7s1.vco)
HexLife are "Life"-like 2d rules with v=3 values on a hexagonal lattice and nearest neighbors. Panels 1 and 2 are snapshots of a k=6 rule (file v3k6s1.vco). Panels 3 and 4 are snapshots of a k=7 rule (file v3k7s1.vco). Panel 1 and 3 start with a single red cell on a white background, showing that the dynamics is trapped in symmetry because totalistic rules are symmetric. In Panel 2 and 4 the initial state is random. The small hexagonal gliders move in the direction of their red heads.

Square k=8 n=120x120 Square k=9 n=120x120 Cubic k=6 n=40x40x40
panel 1. panel 2. panel 3. panel 3.
k=8 kcode=212002210220220012222112022211202221222201222 (v3k8s1.vco)
k=9 kcode=2120022102202200122221121002212112022211202221222201222 (v3k9s1.vco)
k=6 kcode=2020200001110021111120100000 (v3k6a2.vco)
More examples of DD-Life rules related to the family above, with with v=3 values and nearest neighbors, this time on a square and cubic lattice. Panels 1 and 2 are snapshots of a k=8 rule on a 2d square lattice (file v3k8s1.vco).
Panels 3 and 4 are snapshots of a k=6 rule on a 3d cubic lattice (file v3k6a2.vco), as if looking up into a cube. Panel 3 starts with a single white cell on a black background giving a growing icosahedron, and showing that the dynamics is trapped in 3d symmetry because totalistic rules are symmetric. In Panel 4 the initial state is random.
spirals Hex k=6 n=100x120
panel 1. panel 2. panel 3. panel 3.
k=6 kcode=0002000220022001112200021110 (v3k6s2.vco)
Spirals: v=3 k=6 hex nearest neighbors. Initially gliders and other structures emerge, but spirals gradually take over. Panels 1, 2 and 3 are successive snap-shots of the dynamics separated by several dozen time-steps. Panel 4 shows the boundarys between the stable spirals of panel 3.
predator-prey dynamics Hex k=6 n=100x120
panel 1. panel 2. panel 3. panel 3.
k=6 kcode=1202022101201121110121110101 (v3k6s2.vco)
Predator-prey: v=3 k=6 hex nearest neighbors, White is able to grow, green feeds on white - otherwise green can barely survive. Red forms a neutral background. Panels 1, 2, 3, and 4 are successive snapshots of the dynamics separated by several dozen time-steps.

totalistic rules - tcode and kcode

A new option in multi-value DDLab is to limit the program to run forwards only for just totalistic rules ("totalistic mode", enter t at the first prompt). This disables basins of attraction, and works with much shorter lookup tables than the default "basin mode", allowing greater values for v (value range) combined with k (the neighborhood). There are two types of totalistic rules, "kcode" and "tcode":

kcode, k-totalistic rules

For k-totalistic rules, "kcode", the lookup table depends just on the totals of each value in the neighborhood.
DD-Life and other complex rules belong to this "kcode" type..
The size of the table S = (v + k - 1)! / (k! x (v -1)!).
An example of the table for v=3, k=6, S=28, is shown on the right.

I am extremely grateful to Paolo Patelli for providing the decision tree recursive algorithm for listing the strings of possible totals, and for retrieving the lookup table index directly from these string.

            kcode 2121022002022021221222211202
           _lookup table index
          /   _totals strings of 2s, 1s, 0s
         /   /        _a possible lookup table,
        / 2_1_0      /   any outputs (0,1,2) can be entered here
       0: 0 0 6  -> 2
       1: 0 1 5  -> 0
       2: 0 2 4  -> 2
       3: 0 3 3  -> 1
       4: 0 4 2  -> 1
       5: 0 5 1  -> 2
       6: 0 6 0  -> 2
       7: 1 0 5  -> 2
       8: 1 1 4  -> 2
       9: 1 2 3  -> 1
      10: 1 3 2  -> 2
      11: 1 4 1  -> 2
      12: 1 5 0  -> 1
      13: 2 0 4  -> 2
      14: 2 1 3  -> 0
      15: 2 2 2  -> 2
      16: 2 3 1  -> 2
      17: 2 4 0  -> 0
      18: 3 0 3  -> 2
      19: 3 1 2  -> 0
      20: 3 2 1  -> 0
      21: 3 3 0  -> 2
      22: 4 0 2  -> 2
      23: 4 1 1  -> 0
      24: 4 2 0  -> 1
      25: 5 0 1  -> 2
      26: 5 1 0  -> 1
      27: 6 0 0  -> 2


For t-totalistic rules, "tcode", the lookup table has S = ((v-1) x k)+1 entries for each possible sum of the all the values in the neighborhood.
An example of the table for v=3, k=6, S=13 (12 to 0), is shown on the right.


In both cases, lookup tables are set out with the highest index on the left. If v=2 the lookup tables for vcode and kcode, and the resulting dynamics, are identical.
           tcode 2012202000211
          _totals, and lookup table index
         /    _a possible lookup table,
        /    /   any outputs (0,1,2) can be entered here
      12 -> 2
      11 -> 0
      10 -> 1
       9 -> 2
       8 -> 2
       7 -> 0
       6 -> 2
       5 -> 0
       4 -> 0
       3 -> 0
       2 -> 2
       1 -> 1
       0 -> 1

The totalistic rules can be loaded in either "totalistic mode" or "basin mode", but in "basin mode" the short lookup tables are translated into the full lookup table. Running forward on-the-fly option 1 (bit flip or value flip) and 2 (flip back) work on the short lookup tables in "totalistic mode", and on the full lookup tables in "basin mode". To show the lookup table in the xterm window (as above, not for DOS), after setting the rule, backtrack to the rule selection prompt, then enter x.

how to run DD-Life and other complex rules in multi-value DDLab

DDLab presents a series of prompts, asking for input at a flashing cursor. Every prompt has a default (so if in doubt press Enter to accept it). Backtrack in reverse order in the prompt sequence with q. There is a main sequence of prompts, which appear one below the other on the left of the screen, interspersed with special prompts, usually in a top right window. Although the existing DDLab manual applies to the binary version, most explanations in it can be reinterpreted for the multi-value version by the astute reader.

Below are "quick start" instructions for running the DD-Life and other complex CA shown above based on a k=6 hexagonal 2d lattice (i.e. each cell is connected to its 6 neighbors). Prompts, and responses to prompts, are shown in bold, the precise wording may vary. Backtrack with q. We start with the first (2 line) prompt of the main sequence of prompts when starting DDLab.

EXIT-q, graphics setup-g, randseed-r, totalistic/forward only-t
forward only/single basin/subtree-s (def-field): Enter t for the short, totalistic lookup table (recommended). Alternatively enter s for the full look-up table.

If t was entered, which we will assume from now on, the first 2 line prompt changes to...
EXIT-q, graphics setup-g, randseed-r, allow basins-b
totalistic rules and forwards only (def): Press Enter.

Value range (def 2, max 8): Enter 3.

enter cell scale in pixels, default 5: Press Enter. This can be rescaled later on-the-fly.

Network size (length) max to fit 185, default 150: Press Enter. This is the default for a 1d CA. It will be superseded when setting 2d or 3d.

Neighborhood size k: mixed-m, or enter 1-25 (def 3): Enter 6, or the required k. k can be reset when specifying 2d or 3d.

At this point a top right window appears with a series of prompts. For a 1d CA you would press Enter to skip them.
WIRING: special-s load-l random-r
regular: 3d-3, 2d-2 (hex+x), 1d-def: Enter 2 for 2d (k=6 gives a hex lattice, otherwise adding x forces a hex lattice), enter 3 for 3d.
forwards only (uses less memory, slower)-y: Press Enter.
2d, enter width (def 40): Enter 100 depth (def 40): Enter 120 (or what you prefer). On a true hex lattice this is roughly square.
Neighborhood size k: mixed-m, or enter 1-25 (def 6): Enter 6 (or press Enter for the default), or the required k. This is a repeat of the main sequence prompt.

At his point a small top-center window may flash up: setting things up, wait...

The main sequence of prompts resumes:
totalistic only: tcode-t (def-kcode): Press Enter. DD-Life and other complex rules are all kcode, k-totalistic rules.

At this point another top right prompt appears:
RULES: single code (def), load rulemix-l, amend k-matrix-a mix: no limit-n, or set limit up to 200: Press Enter. This prompt is for for mixed-rule networks - we can ignore it.

The main sequence resumes with a 2 line prompt: (note "v3k6" corresponds to your selections above.)
Select v3k6 (table=28) totalistic kcode: empty-e fill-f printxterm-x
maj-m rand-r bits-b hex-h repeat-p load-l (def-rand): Enter l to load a tcode file, for other options see the manual.
A top right prompt allows the rule to be loaded, enter the filename. For the k=6 HexLife enter v3k6s1 (without the extension .vco, this is added automatically), or load any other v3k6.. rule. Note that v and k for the file must be the same as the v and k selected before, otherwise you get an error message. For further filing info and options see the manual. Then you should see the lookup table in color, and the following prompt:
kcode loaded, revise-q, continue-ret: Press Enter.
The rule will be shown in hex, some details about it appear in a bottom window, and also a top right prompt appears (for the network architecture and network graph, see the manual) which we can skip - press Enter.

At this point a large main sequence window appears, with a 2 line prompt:
Select SEED (v3 2d ij=100,120), win-w empty-e fill-f rand-r
bits2d-b hex-h repeat-p load-l (def-r): Press Enter, or enter r, for a random seed, the initial state.
central 2d block(def diam 20), all-a size (max98): Press Enter. The seed can be reset later on-the-fly. The seed is displayed, with various options including a top right prompt to save the seed. - Press Enter, probably twice, until the prompt below appears.

This is the final prompt, together with a top center hint accept defaults-d. We are almost there!
FORWARDS ONLY options: analysis-a histograms-h (ALL-def): Enter d to skip numerous "forwards only" options, and start running the CA.

Now the 2d CA starts from the seed in the top left of the screen. The window on the right is the on-the-fly key index, indicating changes that can be made by a single key press while the CA is running. Try some:
g to enter a randomly chosen complex rule from an included sample (in dd_extra.tar.gz),
1 for random value flips in the kcode table, 2 to restore the flips,
r for a random kcode,
e or c to expand or contract the scale,
O for the original rule,
4 for 5 for a single cell value against a uniform background,
v for a random central patch,
l to perturb a single cell, L to perturb a central patch,
0 to randomly change the color scheme.
There are many other on the fly options - some are slightly different than shown in the manual.

Press q to stop the CA. This gives a top right interrupt options window. Press Enter to continue running. From the interrupt options you can backtrack with q. The interrupt options allow you to revise, save, or load; the rule, seed or current state; and various other things.

Run the other 2d rules as described above, but with the required neighborhood k, network size i,j, and filename.

how to run the 3dLife

For 3dLife do as above with k=6 (nearest neighbors, north south, east, west, up, down) and max network size i*j*h <= 40*40*40.
Load the 3d filename v3k6a2.vco or v3k6x1.vco (these rules also give interesting mobile structures in 2d);

back to the DDLab home page
Last modified: Feb 2004