beltoforion.de
 Impressum |  CSS |  XHTML

Cellular automate


A cellular automaton is a discrete model studied in computability theory, mathematics, theoretical biology and microstructure modeling. It consists of a regular grid of cells, each in one of a finite number of states. The grid can be in any finite number of dimensions. Time is also discrete, and the state of a cell at time t is a function of the states of a finite number of cells (called its neighborhood) at time t − 1. These neighbors are a selection of cells relative to the specified cell, and do not change (though the cell itself may be in its neighborhood, it is not usually considered a neighbor). Every cell has the same rule for updating, based on the values in this neighbourhood. Each time the rules are applied to the whole grid a new generation is created. (description taken from Wikipedia)

Set of Rules


Depending on the rules of the automate you can get a variety of interesting patterns. The applet here is based on the code of xsand.c by Michael Creutz which is part of the xtoys package.

java plugin is missing

The rules are very simple. At each time step the value in a cell is reduced by 4. The values in all four neighboring cells are increased by one. This is like a sandpile spreading out to its neighboring cells:

    M[x][y] -= 4;
    M[x - 1][y]++;
    M[x + 1][y]++;
    M[x][y - 1]++;
    M[x][y + 1]++;
  

Thats all it needs for the complex patterns to emerge. Of course you have to start with something so i initialize the automate with a simple pattern to get it started.

Download and Useage


Download icon  Download jar file
Download icon  Download source code (requires Netbeans)

In order to use the applet add the following lines to your html code:

  <object classid="java:cell.class" type="application/x-java-applet" width="400" height="400">
    <param name="archive" value="JCell.jar"/>
    <param name="code" value="cell.class"/>
    <param name="pixsize" value="1"/>
    <param name="sleep" value="1"/>
    <param name="preview" value="false"/>
  </object>
    

The following table lists the applet parameters and their meaning:

Parameter Meaning
pixsize The size of a pixel
sleep time to wait after each frame (in milli seconds)
preview If this value is true the applet looks like an image only moving when the mouse is over the applet.