The Hodgepodge Machine

Here is a really strange cellular automaton from the pages of Scientific
American that seems to simulate the waves that occur during some chemical
reactions. By controlling the automaton parameters you can determine the
type of patterns produced, the rate of pattern evolution and the intensity
of any reaction waves produced after evolution. To me it is another toy for
making endless 'hippie' designs.

The Hodgepodge Machine, as it was called by its creators Martin Gerhardt
and Heike Schuster, simulates the reactions that take place in exitable
chemical mediums, two or more compounds that can dissociate and recombine in
the presence of a catalyst. If the chemical states of the reactants have
different colors, wavelike structures can be seen that propagate along simple
or intricate frontiers in endless pursuit of an elusive equilibrium, as stated
in the August 1988 Scientific American.

Hodgepodge uses a 80 by 96 grid of cells with each cell having a large number
of possible states, up to 255. The states are reduced to a four color image
in graphics mode 7. The automaton starts off in a random state using four
variables to control production of new generations. These are:

  NS    Number of cell states
  K1    Constant 1 (infect)
  K2    Constant 2 (ill)
  G     Rate of infection.

A cell is termed healthy if state 0 and ill if in the maximum state, NS.
Any state between healthy and ill are varying degrees of infection.
Three rules are applied to each cell depending on if it is healthy, infected
or ill. The future state of a cell is affected by its eight surrounding cells.
All future states are computed before going to the next generation.

A = number of surr. infected cells
B = number of surr. ill cells
S = sum of surr. cell states

If healthy then newstate=[A/K1]+[B/K2]
If infected then newstate=[S/A]+G
If ill then newstate=0

The [] brackets mean round down, 2.75 comes out 2. This happens anyways in
machine code. Basically the K1 and K2 variables control the behaviour of
healthy cells in state 0 and if surrounded by healthy cells stays healthy.
G controls the infected cells and the infection rate is accelerated by
surrounding sick cells. Finally any cell that makes in to the final state
of ill becomes healthy in the next generation.

Main Menu...

 N   Change number of cell states
 1   Change constant one
 2   Change constant two
 G   Change rate of infection
 S   Initialize with random start
 C   Continue with current states

These selections are shown in a text window along with the current values and
the cycle number. During the generation process press ESC to get back to menu.