org.generation5.demos
Class SwarmAntCA

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

public class SwarmAntCA
extends CellularAutomataLayered


Nested Class Summary
protected  class SwarmAntCA.SwarmAgent
           
 
Field Summary
protected  int foodSize
           
protected  int[][] goals
           
protected  int iterations
           
protected  int nestSize
           
protected  int nestX
           
protected  int nestY
           
 
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
  SwarmAntCA()
          Creates a new instance of SwarmAntCA
protected SwarmAntCA(int size_x, int size_y)
           
 
Method Summary
protected  int atFoodSource(DirectedCAAgent ca)
           
protected  boolean atNest(DirectedCAAgent ca)
           
 void doStep()
          This abstract function is where the main workings of the CA should take place.
 void init()
          This abstract function is where the initialization of the CA should take place.
static void main(java.lang.String[] args)
           
 void render(java.awt.Graphics graphics, int pw, int ph)
          Draws the world state, then each automata.
 
Methods inherited from class org.generation5.bio.CellularAutomataLayered
addAutomaton, addAutomaton, getCA, getCollisionDetection, getNumCAs, isCellFree, moveCAAbsolute, moveCARelative, removeAll, 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

nestX

protected int nestX

nestY

protected int nestY

goals

protected int[][] goals

iterations

protected int iterations

nestSize

protected int nestSize

foodSize

protected int foodSize
Constructor Detail

SwarmAntCA

public SwarmAntCA()
Creates a new instance of SwarmAntCA


SwarmAntCA

protected SwarmAntCA(int size_x,
                     int size_y)
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

doStep

public void doStep()
Description copied from class: CellularAutomata
This abstract function is where the main workings of the CA should take place. Every iteration, this function is called causing the CA to advance a step.

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

atNest

protected boolean atNest(DirectedCAAgent ca)

atFoodSource

protected int atFoodSource(DirectedCAAgent ca)

init

public void init()
Description copied from class: CellularAutomata
This abstract function is where the initialization of the CA should take place. This function is also called when the CA is reset, so one-time initialization should remain in the constructors.

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

render

public void render(java.awt.Graphics graphics,
                   int pw,
                   int ph)
Description copied from class: CellularAutomataLayered
Draws the world state, then each automata.

Specified by:
render in interface Visualizable
Overrides:
render in class CellularAutomataLayered
Parameters:
graphics - the graphics context.
pw - the width of the context.
ph - the height of the context.

This documentation is part of the Generation5 JDK.