ca
simulate arbitrary one-dimensional cellular automata
ca -help
or
ca [-width integer] [-height integer] [-states inte-
ger] [-radius integer] [-seed integer] [-wrap]
[-rules string] [-init string] [-lambda double]
[-sq] [-bin] [-inv] [-mag integer] [-term string]
Simulates arbitrary one-dimensional cellular automata with an arbitrary choice of simulation parameters. Random rules can be generated and used with a desired lambda value.
Computes a one-dimensional cellular automata. The evolution of the CA is determined by the number of states, the radius size, the initial state, and the supplied rule. A rule is specified by a (states - 1) (radius 2 + 1) length string. At each time step a sum of each cell plus all of its neighbors within the radius is computed. That sum is used as an index into the rules string which determines the next step For example, with radius = 1 and states = 2 the rule that sums of 0 and 3 map to the 0 state, and sums of 1 and 2 map to the 1 state. A negative init string randomly initializes the starting states. If the init string is of being non-zero.
Miscellany
When supplying a lambda value for a random rule, it may not be possible to find a string with that lambda value because one may not exist. In this case, the program will do its best to find one as close as possible. In any event, the algorithm for finding random rules strings for a specified lambda value is non-deterministic and may not always find a perfect match even if one exists. However, it will work well with high probability, and even when it doesn't find a perfect match it almost always gets close.
Bugs
No sanity checks are performed to make sure that any of the options make sense.
Options
-width | Width of the plot in pixels. | 640 |
-height | Height of the plot in pixels. | 480 |
-states | Number of CA states. | 2 |
-radius | Radius of CA neighborhood. | 1 |
-seed | Random seed. | 0 |
-wrap | Use a wrap-around space? | True |
-rules | CA rules to use. | 0110 |
-init | Starting state (< 0 is random). | 11 |
-lambda | Lambda value for random rules. | -1.0 |
-sq | Enforce strong quiescence? | True |
-bin | Binary colors? | False |
-inv | Invert all colors? | False |
-mag | Magnification factor. | 1 |
-term | How to plot points. | None |