ca21.icn: Program to investigate cellular automata

May 2, 2001; Ralph E. Griswold
Requires: Version 9 graphics; system(), pipes, /tmp for -e option
This file is in the public domain.
This program displays the time-sequence development on one-dimensional
cellular automata in which the state of a cell depends only on the
two cells adjacent to it -- 2,1 automata.

See "Theory and Applications of Cellular Automata", Stephan Wolfram,
World Scientific, 1986 for an explanation for the method and rule
encoding.

The options supported are:

     -r i    rule i, default 110
     -w i    width (number of cells), default 200
     -h i    height (number of time steps), default width
     -s      seed first row at random with <= width / 2 cells
     -R      randomize the run
     -e s    initialize first row with seeds at positions generated
                by Icon expression e.
     -i s    save final image in file named s; default no image
     -H      use hidden window; if no image file specified, ca21.gif
                is used

The -e option is powerful but somewhat strange.  For example, to
seed every other cell in the first row, use

     -e 'seq(1,2')

which generates 1, 3, 5, 7, ... and seeds those cells (cells are
numbered starting at 1).

Source code | Program Library Page | Icon Home Page