public class Herbivore extends Animal
Modifier and Type | Field and Description |
---|---|
static Genome |
defaultGenome |
private int[] |
predatorPosition |
age, attemptedMovesThisTurn, energy, exhaustion, generation, genome, gestationPeriod, IDnumber, isAlive, movesThisTurn, offspring, parent, random, type, x, y
Constructor and Description |
---|
Herbivore(int setID,
Genome newGenome,
int myGeneration,
int setX,
int setY,
int setEnergy,
int parentID)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
feed()
Graze the current tile.
|
private void |
flee()
Run away from a predator
|
private void |
moveToNewGrazingGrounds()
Search the surrounding squares for one with a higher grass density and move there
|
void |
update()
Each turn, the herbivore looks out for predators and flees if it finds any,
or otherwise grazes, if need be moving to better feeding grounds
|
changeEnergy, closestSearch, exhaust, getAge, getDirection, getDistance, getEnergy, getGeneration, getGenome, getID, getInfo, getNeighbouringField, getOffspring, getParent, getType, getX, getY, isAlive, mixedSearch, move, randomizedSearch, reproduce, search, setAge, setEnergy, setPosition
private int[] predatorPosition
public static Genome defaultGenome
public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, int setY, int setEnergy, int parentID)
setID
- newGenome
- myGeneration
- setX
- setY
- setEnergy
- parentID
- public void update()
private void feed()
private void moveToNewGrazingGrounds()
private void flee()