org.generation5.demos
Class TermitesCA

java.lang.Object
  extended byorg.generation5.bio.CellularAutomata
      extended byorg.generation5.bio.CellularAutomataLayered
          extended byorg.generation5.demos.TermitesCA
All Implemented Interfaces:
Steppable, Visualizable

public class TermitesCA
extends CellularAutomataLayered

Implements the termites algorithm, randomly sorting a collection of woodchips.


Field Summary
protected  double caPercentage
          The percentage of the cellular automata within the world.
protected  double wcPercentage
          The percentage of woodchips within the world.
 
Fields inherited from class org.generation5.bio.CellularAutomataLayered
clrStates, collisionDetection, positionTest
 
Fields inherited from class org.generation5.bio.CellularAutomata
bufferPosition, bufferSize, caSize, caWorld, caWorld_x, caWorld_y, clrBackground, clrGrid, clrWorld, DOUBLE_BUFFERING, doubleBuffering, drawGrid, ENCLOSED, geometryType, INFINITE, TORODIAL, X_AXIS, Y_AXIS
 
Constructor Summary
TermitesCA()
          Default constructor.
TermitesCA(int size_x, int size_y)
          Create an instance with additional size information.
 
Method Summary
 void doStep()
          Advances the world by one timestep.
 void init()
          Initializes the world.
static void main(java.lang.String[] args)
           
 void setPercentages(double cap, double wcp)
          Set the percentages of cellular automata and woodchips.
 
Methods inherited from class org.generation5.bio.CellularAutomataLayered
addAutomaton, addAutomaton, getCA, getCollisionDetection, getNumCAs, isCellFree, moveCAAbsolute, moveCARelative, removeAll, render, setCollisionDetection, setStateColour, setWorldSize
 
Methods inherited from class org.generation5.bio.CellularAutomata
clearWorld, drawGrid, flipBuffer, getBackgroundColor, getCASize, getGeometry, getSizeX, getSizeY, getWorldAt, iterateCA, iterateCA, reset, setBackgroundColor, setCASize, setGeometry, setWorldAt, setWorldAtEx, setWorldAtRelative, setWorldColors, setWorldColour, translateGeometry, writeImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caPercentage

protected double caPercentage
The percentage of the cellular automata within the world.


wcPercentage

protected double wcPercentage
The percentage of woodchips within the world.

Constructor Detail

TermitesCA

public TermitesCA()
Default constructor.


TermitesCA

public TermitesCA(int size_x,
                  int size_y)
Create an instance with additional size information.

Parameters:
size_x - the x-size of the world.
size_y - the y-size of the world.
Method Detail

setPercentages

public void setPercentages(double cap,
                           double wcp)
Set the percentages of cellular automata and woodchips.

Parameters:
cap - the cellular automata percentage.
wcp - the woodchip percentage.

init

public void init()
Initializes the world.

Specified by:
init in interface Steppable
Specified by:
init in class CellularAutomata

doStep

public void doStep()
Advances the world by one timestep.

Specified by:
doStep in interface Steppable
Specified by:
doStep in class CellularAutomata

main

public static void main(java.lang.String[] args)
Parameters:
args - command-line arguments to pass to iterateCA.
See Also:
CellularAutomata.iterateCA(CellularAutomata, String[])

This documentation is part of the Generation5 JDK.