*** LINEAUTO ***
   By Terry Newton

Line Automata are one-dimensional relatives to 2-D automata such as Life.
Each new generation is drawn underneath the previous to form a history pattern
of the automaton. Articles about Line Automata have appeared in the March and
September 1984 Scientific American and in the December 1986 Byte (which also
contains stuff about the Mandelbrot set and Hennon Mappings). Stephen Wolfram,
developer of Mathematica, has conducted extensive research on these and other
cellular automata and classifies the outcome of 1-D automata rules
into four catagories:

 Class 1 - Only evolve for a few generations before dying out.
 No sustaining power in the rule.

 Class 2 - These quickly reach a state containing simple periodic
 structures that repeat forever, forming columns.

 Class 3 - Produce chaotic constantly stanging patterns full of
 triangles but no overall structure. About 80 percent of randomly
 selected rules produce this type of behavior.

 Class 4 - This is the rarest type and produce long lived streaming
 structures and complex persistant forms that glide across the screen.
 These are the most interesting automata to investigate.

In my program each cell in the line can take on four states. The line is 160
cells wide with no wrap-around. The characteristic behavior of the automaton
generated is determined by the rule, a string of the digits 0 to 3 that
relates the neighborhood sum of states to the next cell state. The length
of the rule string implies which surrounding cells affect each cell.
Consider the rule 0100000. The first digit specifies the state for a zero sum,
then one, etc. The last digit is for a sum of six which is the maximum sum for
two cells in a four state automaton. Therefore only the two cells on either
side of a cell affects its outcome. In this rule a cell is in state one if
the sum of the neighborhood is 1, or only one of the neighboring cells is
in state 1. Any other sum results in state 0. This rule results in a class 3
automaton. The maximum size neighborhood allowed is 7 resulting in a 22 digit
rule string.

After getting past the intro screen you will see the current rule string and
neighborhood size with the cursor on the first digit of the rule. Press RETURN
to generate this automaton. Only a few seconds are needed to produce 192
generations for an entire screen. At any time press ESC to get back to the
rule screen or press any other key after generation for the next screen.

You can change the rule to any string of the digits 0 to 3 up to 22 digits
long. The minimum rule size is 7, after which the rule size increases by 3
with each new cell added to the neighborhood. Press SPACE to normalize the
rule length. Use the cursor left and right keys [+] and [*] to position the
cursor. Press CLEAR [<] to wipe out the rule past the cursor position and
normalize the rule length.

Press [E] to edit the starting pattern to begin the automaton with a
particular pattern. At the rule screen press [R] to revert back to a random
start each time. The edit screen shows the starting line of 160 cells minus
the first one and last two. A bug I guess. Use the cursor keys to move around.
Shifted CLEAR sets the start to all zeros and the digits 0 to 3 to change the
states. ESC goes back to the rule screen. Once defined this start stays
in effect until [R] is pressed to go into random mode.

Press [C] to change the cell colors. [R] changes the register for
states 0 to 3. [H] increases the hue number and [L] increases the
luminosity value.

Sorry no load and save functions although it wouldn't be hard to do.
The automaton is completely defined by the rule and the starting pattern,
which is usually random. The rule detemines the character of the automaton
while the starting pattern locks in the particular structures created in
future generations.

LINEAUTO uses high speed machine code to calculate an entire screen at once
very quickly. The rest of it was written in the ACE version of C. A small ML
routine is used to display graphics mode 15 on all 8 bit Atari computers.

The following is a list of 'rules that generate interesting patterns' taken
from BYTE December 1986...

0001033232  0001321021  0001321200
0001330123  0002023330  0002320123
0010212332  0010332003  0010332330
0010332321  0011202122  0012003101
0012011001  0012031221  0012300103