EdgeOfChaosCA

Version 2, June 2004

Note: The original EdgeOfChaosCA was written several years ago. This new version makes use
of some features that have been added to the Java programming language since that time,
most significantly the ability to save images such as this one.
(Image saving is available only when the program is run as an application, not when you run the
applet on this page. See the bottom of this page to download the application.)
However, this new version will not work with older versions of Java.
If this version does not work in your
Web browser, see Version 1
(September 2006: Version 2.01 fixes the fact that the image didn't scroll
properly on Mac OS.)

The EdgeOfChaosCA applet creates randomly-generated one-dimensional cellular automata and
lets you see them in action. You can adjust a so-called "Lambda" parameter to try to find the
"edge of chaos" where the most interesting things are supposed to happen. If you don't know
what this means, you can read a page of information about cellular automata
and another page about the Edge of Chaos.

Instructions: A cellular automaton is a one-dimensional "world," shown as
a row of colored squares. The world evolves over time through a sequence of generations,
following the rules that define the automaton. By drawing each generation under the
previous generation, you get a two-dimensional image. This is the type of image that
is shown in the EdgeOfChaosCA window. The exact image that you get depends on the
exact rules of the automaton. Five sample rule sets are available in the
EdgeOfChaosCA "Examples" menu. Just select one of the examples, and watch what
happens. Note that the size of the cellular automaton world can be bigger than
the width of the window. In that case, a scroll bar appears at the bottom of the
window, and you can use this scroll bar to view the whole world.

The slider at the top of the window is used to adjust the "Lambda" parameter of
the cellular automaton. One of the states of the automaton---state number 0,
represented by the color white by default---is said to be "dead." Every other
state is considered to be "alive." The Lambda parameter is simply the fraction of
all the rules that lead to "alive" states. When Lambda is small, most rules lead to
"death," and all the cells tend to die off quickly. When Lambda is large, most rules
lead to "life," but the result tends to be "chaos," a meaningless jumble of color.
The nicest-looking pictures are supposed to occur somewhere between these two extremes,
on the "edge of chaos." The main point of the applet is to adjust the Lambda slider
to see whether you can observe the edge. In the process, you can make some pretty
pictures. (Note: When you adjust the Lambda value, the world is restarted from
generation 0, using the same initial world.)

The first command in the "Control" menu allows you to pause and resume the production of
new generations of the automaton. When the action is paused, the second command in this
menu lets you produce one generation at a time. The following five commands in the
"Control" menu control the speed at which new generations are produced.

The next five commands in the "Control" menu are for restarting the world from
generation zero. The "Start World Again" command will restart using the same world
that produced the current image. This will re-play exactly the same sequence of
generations. The "First Image then Stop" does what it says: It runs starting
from generation zero until one full image has been produced, then stops. (The
number of generations in a full image is specified when the world is first created.)
The "New Random World" command creates a new world by setting each cell in the world
to a randomly selected state, and uses that world as the starting generation.
The "New Random Clump" creates a world in which the middle 51 cells are set to
random values, and the remaining cells are set to be dead. The "Single Dot Start"
command starts with a world in which the middle cell is set to state 1 and all the
other cells are dead. (This world tends to die off quickly, unless Lambda is
fairly large.)

The final command in the "Control" menu is "Colors." This command opens a
dialog box that you can use to set the colors that are used to represent the
different possible states that a cell can be in. Several pre-set palettes
of colors are available, and you can set an individual color by clicking on it.
Note that color number 0 is the color of the "dead" state.

The "File" menu has two commands that can be used to create new cellular automata.
The rules for an automaton are generated randomly, but based on certain parameters
that you can set. The "New" command opens a dialog box where you can set the
parameters that will be used to create the new automaton. The
"New with Same Settings" command creates a new world using
the same parameters as the the current world. The parameters that you can
set in the "New" dialog are as follows (the first two are the most important):

Number of States: This is the number of different states that a cell can be in.
That is, it is the number of different colors that can appear in the world.
The minimum number of states is two, since you need a "dead" state and at least
one "alive" state. In this program, the maximum number of states is 32, but this
number is arbitrary.

Neighborhood Size: When a cell "decides" what state to be in in the next generation,
it looks at its own current state and at the states of its neighbors on both sides.
The neighborhood size is the number of neighbors, including the cell itself, that
are considered. If the neighborhood size is 3, then the states of the cell and one neighbor
on the left and one on the right are used to determine the state of the cell in the next
generation. If the neighborhood size is 5, then the cell, two neighbors on the left,
and two neighbors on the right are used. In this program, the neighborhood size is
an odd number, because the neighborhood always includes the same number of neighbors
on the left and on the right. The larger the number of states and the
bigger the neighborhood size, the more rules that
are needed to specify the automaton. To limit the number of rules, there is a
maximum neighborhood size, and the maximum size depends on the number of states.
If the number of states is 16 or greater, the only possible neighborhood size is 3.

Rules are Isotropic: A neighborhood of a cell is a certain pattern of colors, and this
pattern determines the color of the cell in the next generation. Suppose that the
pattern of colors in the neighborhood is reversed left-to-right. Can this affect the
color of the cell in the next generation? If not, the automaton's rules are said
to be "isotropic." If not, they are "anisotropic." Isotropic rules tend to
give more symmetric results, so rules are isotropic by default in this program.
However, you can turn isotropy off if you want.

World is Circular: Cells that are at the left or right end of the world don't
have complete neighborhoods. One solution to this is to pretend
that the left end of the world is attached to the right end, forming a circle.
That is, the cells at the left end are considered to be neighbors of the cells
at the right end, and vice-versa. If you turn off the "World is Circular" option,
then cells at the end of the world are assumed to have neighbors that are
always dead.

Size of World: This setting controls the number of cells in the world. This is the
same as the horizontal size of the image that is created by the program. The
default is to use the width of the window as the size of the world, but you can set
it to be larger or smaller if you want. You can select a value from the drop-down
list, or type in a value yourself.

Height of Image: The program only remembers a certain number of generations of
the world. If you save an image (which you can only do in the application version
of the program, only these generations will be saved. So, the number of saved
generations will be the height of the image. By default, the number of saved
generations is the same as the space available in the window, but you can choose
any value you want. The setting "3/4 * WorldSize" makes it easy to create images
that match standard screen sizes such as 800x600 or 1024x768.

Application Version: Because of security restrictions on applets, the applet on this
page cannot access files. The application version of the program can save image files. It can
also save the data for a cellular automaton in a file, which can be opened again later. In
the application version, the "File" menu contains commands for saving the current image and for
saving and opening files.

This file is an executable jar file. On Windows and MacOS X, you should be able to
run it simply by double-clicking on the file icon (assuming that you have Java 1.4 or later
installed). It can also be run on the command
line with the command "java -jar EdgeOfChaosCA.jar".

This ZIP archive includes the five examples that are available in the applet on this
page. These are simply files that were saved from the program, and you can open them
in the program using the "Open" command.