|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--critter.World
| Constructor Summary | |
World(int x,
int y,
long seed)
Constructs the world of a given size |
|
| Method Summary | |
boolean |
addCritter(critter.Critter obj)
Adds a critter to the world, position and direction are randomly chosen |
boolean |
addCritter(critter.Critter obj,
int x,
int y,
int dir_x,
int dir_y)
Adds a critter to a specified position in the world and with a specified direction |
boolean |
empty(int x,
int y)
true if the position is empty (no obstacle, food or critter |
void |
init(double foodRate,
double obstacleRate)
populates the world with food and obstacles |
int |
peek(int x,
int y)
Retrieves the object found in a particular position on the grid |
void |
updateMoves()
Each critter's act method is called and executed in the world. |
void |
updateSenses()
Updates the state of all critters, has complete control over signals (the way the world gives rise to sensor readings). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public World(int x,
int y,
long seed)
x - number of positions along x-axisy - number of positions along y-axisseed - seed for the random number generator| Method Detail |
public void init(double foodRate,
double obstacleRate)
public int peek(int x,
int y)
public boolean empty(int x,
int y)
public boolean addCritter(critter.Critter obj,
int x,
int y,
int dir_x,
int dir_y)
public boolean addCritter(critter.Critter obj)
public void updateSenses()
public void updateMoves()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||