org.generation5.demos
Class LangtonAntCA

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

public class LangtonAntCA
extends CellularAutomataLayered

Implements Langton's Ant.


Field Summary
static int DOWN
          Ant to move down
static int LEFT
          Ant to move left
static int RIGHT
          Ant to move right
static int UP
          Ant to move up
 
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
LangtonAntCA()
          Default constructor
LangtonAntCA(int size_x, int size_y)
          Constructor with additional size information.
 
Method Summary
 void doStep()
          Advance the ants one timestep.
 void init()
          Initializes the world with one ant in the centre of the world.
static void main(java.lang.String[] args)
           
 
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

UP

public static final int UP
Ant to move up

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Ant to move right

See Also:
Constant Field Values

DOWN

public static final int DOWN
Ant to move down

See Also:
Constant Field Values

LEFT

public static final int LEFT
Ant to move left

See Also:
Constant Field Values
Constructor Detail

LangtonAntCA

public LangtonAntCA()
Default constructor


LangtonAntCA

public LangtonAntCA(int size_x,
                    int size_y)
Constructor with additional size information.

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

doStep

public void doStep()
Advance the ants one timestep.

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

init

public void init()
Initializes the world with one ant in the centre of the world.

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

main

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

This documentation is part of the Generation5 JDK.