Java Square Cell

A zip file containing my Java Square Cell software which implements a powerful cellular automata (CA) simulator can be down loaded here.

The file contains a basic program, the program I use and its corresponding applet. The Java source code is provided for each of these. The basic program can be easily extended to generate new specific CA simulators, the program can be installed and run on any computer which implements a Java run time environment and the applet can be installed on a server and run by any Java enabled browser.

A large collection of patterns which can be run by the program and applet can be down loaded here.

I wrote these programs for my own use so unfortunately they are not documented. These notes should be sufficient to allow anyone to use and enjoy the programs.

Unlike the Conway's Life enthusiasts I usually only spend a few hours with any particular rule. Just enough to understand the rules rhythms and perhaps construct some ships from puffers and some guns from oscillators.

Rather than define rule families as a table or tree I have taken the simple approach of defining them as Java code. To add a new rule family requires the coding of an extension to the rule class and of classes to display and obtain rule parameters and options.

The program is controlled by buttons on a toolbar and by the keyboard and mouse. Each of the buttons has an associated hint which briefly tells what it does. The keyboard is used for panning the world (arrow and shift keys) sizing the grid (+ - keys) and short cuts. The keyboard and mouse are used for pattern editing.

The state of a cell can be changed by clicking on it. This changes the state to the state selected in the Color Selector. Clicking a cell with the shift key depressed steps through all the possible states.

A group of cells may be selected by clicking the display with the control key depressed, The first click marks a corner of the selection area and the second click marks the diagonally opposite corner. A third click clears the selection. When selected a group of cells may be manipulated by several of the toolbar buttons. Selections may be rotated, flipped, written to a file, set to a random state and moved or copied by dragging. The inside or outside of a selection may also be cleared.

Selected cells do not participate when the simulation is run and thus selections may be used for temporary storage and pattern synchronization.

When a pattern has been loaded from a file in a directory, the other pattern files in that directory may be loaded with the page down and page up keys. Page down rotates through the files in a forward direction while page up rotates through them in a backward direction. The home key reloads the current pattern.

Short cuts are provided for starting and stopping the simulation (return key), stepping the simulation (space bar), setting the cells to random states (r key) and generating a new rule (n key). Most of the buttons are disabled when the simulation is running or analyzing. When the simulation is running the + and - keys may be used to adjust the simulations speed.

An error dialog is displayed if an attempt to load a pattern larger than the size of the simulation is made. If this situation occurs, make sure the world size is greater than the pattern size. Pattern files are readable text files. If the simulation is running too slowly, try reducing the world size. I usually run Interacting States patterns on a 500x500 grid.

Java Square Cell uses very simple random techniques to generate new rules. I would like to implement a more sophisticated algorithm perhaps based on genetic evolution. I'm looking for someone to help with this!

The rule families that are supported are refinements of earlier work. Weighted Generations started as a DLL extension to MCell and is documented here and here.

The new implementation uses a table of new states to determine the new state of a cell. The table columns are indexed by the weighted neighbor counts and the rows are indexed by the old cell state. The table can be changed with mouse clicks in the same way that patterns are changed. Table cell positions are shown in the status bar.

The difference between the Rule Table and Weighted Generations families is minor. In Rule Table the state of a cell is set to 0 if its weighted neighbor count is outside the bounds of the table. The Weighted Generations family survives so that patterns generated on older simulators can be run.

Interacting states also evolved from an extension to MCell and is documented here and here. This family has not changed since its first implementation.

Bit counts is new. Here the count of the neighbor state bits is used as an index into a vector defining the new state. This vector can also be changed with mouse clicks.

Three experimental rule families are implemented. The first of these implements an additional version of Rule Table called "Rule Table 2". Here table columns are indexed by the weighted neighbor counts as before but table rows are indexed by the number of neighbors that are not in state 0.

The other two experimental rule families are called "Counts" and "Counts 2". Counts uses a vector to define new states. The sum of the state values of selected neighbors is used as an index into this vector. Counts 2 uses a table to select new states. The table row and column are selected by summing the state values of two distinct neighbor sets.

The other supported rules are custom coded and their associated patterns are in directory ~/Java Square Cell Patterns/Patterns

Since the work of David Eppstein here seems to indicate that knight ships are somewhat rare, the extensive collection of rules that support such ships may be of interest. They are in the directory ~/Java Square Cell Patterns/Patterns/Knight Patterns.

Each of the pattern sub directories contains a file ../Scripts/Index.html. This file shows the number and type of patterns contained in each rule directory. The rules with the most patterns are probably the ones that interested me the most.

One of the first rules that I explored was the Generations rule Snake. The oscillators in this rule fascinated me. You can see these in directory ~/Java Square Cell Patterns/Patterns/Rule Table/Oscillators. I still don't know whether pattern o4.sqc is an oscillator.

The applet has been installed here and the pattern collection has been installed here. Each of the patterns in the collection can be loaded and run by the applet. Patterns can also be written to a designated directory on the server called "User Patterns". File names should use only alphanumeric characters and must end with ".sqc". Existing files cannot be overwritten.

A simple browser is used to view and select patten files. This browser can also be used to view this file and the index files described above.

I would be interested in any suggestions for improving this program and especially interested in any additions that are implemented.

I have recently written two new programs which have a similar interface to this one. The first uses a hexagonal grid and is called "Hexagonal Cell" and the second uses an equilateral triangular grid and is called "Triangular Cell". You can download the Java source code together with some sample patterns here.

Brian Prentice