ArtificialTermites
Class World

java.lang.Object
  |
  +--ArtificialTermites.World

public final class World
extends java.lang.Object

World is the main class of the simulation for artificial life for anthill. Seconde line of documentation for World.


Field Summary
private  int cheesePercentage
           
private  boolean[][] cheeseWorld
           
(package private) static int defaultCheesePercentage
           
(package private) static int defaultTermitePercentage
           
(package private) static int defaultWheatPercentage
           
(package private) static int defaultWoodPercentage
           
(package private) static int defaultWorldHeight
           
(package private) static int defaultWorldWidth
           
private  java.lang.Thread engineThread
           
private  boolean[][] forbiddenWorld
           
private  long randomSeed
           
private  boolean ready
           
private  int termitePercentage
           
private  Queue termiteQueue
           
private  boolean[][] thingWorld
           
private  int wheatPercentage
           
private  boolean[][] wheatWorld
           
private  int woodPercentage
           
private  boolean[][] woodWorld
           
private  WorldApplet worldApplet
          The queue of ants.
private  int worldHeight
           
private  int worldWidth
           
 
Constructor Summary
World()
           
 
Method Summary
private  void addCheese()
           
private  void addTermite()
           
private  void addWheat()
           
private  void addWood()
           
(package private)  boolean cheeseAt(int x, int y)
           
(package private)  int cheesePercentage()
           
 void finalize()
           
(package private)  boolean forbiddenAt(int x, int y)
           
(package private)  void getCheese(int x, int y)
           
 boolean getReady()
           
 Queue getTermiteQueue()
           
(package private)  void getWheat(int x, int y)
           
(package private)  void getWood(int x, int y)
           
 WorldApplet getWorldApplet()
           
(package private)  int height()
           
private  void initialiseForbiddenWorld()
           
(package private)  void initialiseWorld(int width, int height, int wood, int wheat, int cheese, int termites, WorldApplet world)
          Set the background, objects, food and ants randomly on the payload.
(package private) static int mod(int x, int y)
           
(package private)  void putCheese(int x, int y)
           
(package private)  void putWheat(int x, int y)
           
(package private)  void putWood(int x, int y)
           
(package private)  int random(int range)
           
(package private)  void resetForbiddenWorld(int x, int y)
           
 void run()
           
(package private)  void setForbiddenWorld(int x, int y)
           
 void start()
           
 void stop()
           
(package private)  int termitePercentage()
           
(package private)  boolean thingAt(int x, int y)
           
(package private)  boolean wheatAt(int x, int y)
           
(package private)  int wheatPercentage()
           
(package private)  int width()
           
(package private)  boolean woodAt(int x, int y)
           
(package private)  int woodPercentage()
           
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

worldApplet

private WorldApplet worldApplet
The queue of ants. Each ant is in its thread.

termiteQueue

private Queue termiteQueue

forbiddenWorld

private boolean[][] forbiddenWorld

thingWorld

private boolean[][] thingWorld

woodWorld

private boolean[][] woodWorld

wheatWorld

private boolean[][] wheatWorld

cheeseWorld

private boolean[][] cheeseWorld

worldWidth

private int worldWidth

worldHeight

private int worldHeight

woodPercentage

private int woodPercentage

wheatPercentage

private int wheatPercentage

cheesePercentage

private int cheesePercentage

termitePercentage

private int termitePercentage

ready

private boolean ready

randomSeed

private long randomSeed

engineThread

private java.lang.Thread engineThread

defaultWoodPercentage

static int defaultWoodPercentage

defaultWheatPercentage

static int defaultWheatPercentage

defaultCheesePercentage

static int defaultCheesePercentage

defaultTermitePercentage

static int defaultTermitePercentage

defaultWorldWidth

static int defaultWorldWidth

defaultWorldHeight

static int defaultWorldHeight
Constructor Detail

World

public World()
Method Detail

initialiseWorld

void initialiseWorld(int width,
                     int height,
                     int wood,
                     int wheat,
                     int cheese,
                     int termites,
                     WorldApplet world)
Set the background, objects, food and ants randomly on the payload.
Parameters:
width - width of logical payload
wFactor - factor of width between low logical level and graphical level
height - height of logical payload
hFactor - factor of height between low logical level and graphical level
block - should be 1, here for historical reasons
wood - percentage of wood
wheat - percentage of wheat
cheese - percentage of cheese
termites - percentage of ants

initialiseForbiddenWorld

private void initialiseForbiddenWorld()

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object

start

public void start()

stop

public void stop()

run

public void run()

random

int random(int range)

forbiddenAt

boolean forbiddenAt(int x,
                    int y)

thingAt

boolean thingAt(int x,
                int y)

woodAt

boolean woodAt(int x,
               int y)

wheatAt

boolean wheatAt(int x,
                int y)

cheeseAt

boolean cheeseAt(int x,
                 int y)

woodPercentage

int woodPercentage()

wheatPercentage

int wheatPercentage()

cheesePercentage

int cheesePercentage()

termitePercentage

int termitePercentage()

width

int width()

height

int height()

setForbiddenWorld

void setForbiddenWorld(int x,
                       int y)

resetForbiddenWorld

void resetForbiddenWorld(int x,
                         int y)

addWood

private void addWood()

addWheat

private void addWheat()

addCheese

private void addCheese()

addTermite

private void addTermite()

putWood

void putWood(int x,
             int y)

getWood

void getWood(int x,
             int y)

putWheat

void putWheat(int x,
              int y)

getWheat

void getWheat(int x,
              int y)

putCheese

void putCheese(int x,
               int y)

getCheese

void getCheese(int x,
               int y)

mod

static int mod(int x,
               int y)

getTermiteQueue

public Queue getTermiteQueue()

getWorldApplet

public WorldApplet getWorldApplet()

getReady

public boolean getReady()