*** CELLS *** By Terry Newton

In 1969 John Conway invented Life and since then countless computer hours
have been wasted away on those funny moving patterns. Life is simple, it only
has three rules, yet it produces colonies of cells that grow and die as in
biological systems. CELLS is my version of Conway's Game of Life for the
Atari 8 bit computers.

Life is a Cellular Automata played on a grid of cells. Each cell is either
alive or dead. The birth, survival and death of each cell is determined by
its surrounding eight cells. Once the new states are computed, they all
change at once and the process repeats.

Birth Rule: If the cell is dead and is surrounded by three
 live cells it turns on in the next generation.

Survival Rule: If the cell is alive and surrounded two or three
 live cells it remains alive.

Death Rule: If the cell is surrounded by less than two or
 more than three live cells it turns off.

CELLS uses a 160 by 96 grid of cells that should be sufficient for most life
experiments [edit ha! little did I know!] and is about as good as it gets on
8 bit without sacrificing speed [well that's close, those old machines were
like 10,000 times slower than a modern PC]. CELLS produces a new generation
every second on average, depending on the cell density.

Main Menu...

GENERATION and POPULATION - Displays the current status of the colony.

(R) Random Mode - Starts the automaton with a random pattern then generates
the cells until they all stabilize then creates a new random pattern.
Press RETURN for a new start, SPACE to pause generation, or ESC for the menu.

(E) Edit Cells - Displays a flashing cell movable by the cursor keys (-=+*).
Press SPACE to flip the cell on and off, (L) to lock or unlock the cursor
state, SHIFT CLEAR to clear the screen, RETURN to start generation,
or ESC for the menu.

(C) Continue - Generates the cells. Press SPACE to pause or ESC for the menu.

(S) Save - Saves the current screen to a disk file. The filename defaults to
the drive CELLS was loaded from and the extension 'LIF' if not specified in
the file name. The screen is compressed to produce a small file only a
few hundred bytes long.

(L) Load - Loads in a saved screen file from disk.

(P) Parameter menu...

  (D) Density - Determines the cell density of random starts and ranges
  from 1 to 254 with 128 being 50%.

  (R) Repeats - How many repeating generations allowed before declaring dead
  and ranges from 1 to 255.

  (E) Escape When Dead (Y/N) - If yes dead colonies go to the menu or editor
  when not in random mode.

  (C) Colors - Allows cell colors to be changed. Press (C) for color register,
  (H) to change hue and (L) to change luminosity. (M) changes the display
  mode, color or monochrome. Any other key returns to the main menu.

  (X) Exit to DOS after confirming. If running under SpartaDos you can
  restart CELLS with the RUN command performing DOS functions.

  (ESC) Main menu.


The cells are displayed in four colors. Color 0 is dead, color 1 is birth,
Colors 2 and 3 are survival. If in monochrome mode all live cells are color 1.
Wrap around will occur on the sides of the screen with a one cell offset.
Beyond the top and bottom is dead space and life forms that touch it will be
distorted. Gliders will form blocks if they hit the top or bottom.

CELLS was written in ACE C with assembly routines for cell generation and
save/load compression. The grid contains 15360 cells, making for a lot of
computation for each generation. To drastically increase the speed, the code
does not count the surrounding cells during generation. Instead each birth
increments the counts of the surrounding cells and each death decrements the
counts. No time is wasted on dead cells during calculations so the generation
speed depends on cell activity.