|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--critter.Critter
| Field Summary | |
int |
dir_x
|
int |
dir_y
|
static int |
DIRECTION_X
|
static int |
DIRECTION_Y
|
int |
energy
|
int |
x
|
int |
y
|
| Constructor Summary | |
Critter(critter.Critter p1,
critter.Critter p2)
Constructs a new critter from two parent critters For each neuron wiring, it takes one of the parents' wiring. |
|
Critter(long seed)
Constructs a new critter Initializes the "brain". |
|
| Method Summary | |
int[] |
act()
The control function. |
void |
eat()
The function which is called whenever the critter finds food, increases energy level (and lifetime). |
double |
fitness()
The fitness/objective function |
void |
mutate(double prob)
Mutate the critters neuron wires by a probability |
void |
percept(int[] sig)
The function which is called whenever the critter needs to update its senses. |
void |
print()
Helper function to print out details of a critter. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static int DIRECTION_X
public static int DIRECTION_Y
public int energy
public int x
public int y
public int dir_x
public int dir_y
| Constructor Detail |
public Critter(long seed)
seed - the seed use for the random generator
public Critter(critter.Critter p1,
critter.Critter p2)
| Method Detail |
public void mutate(double prob)
prob - the probability by which each wire is flippedpublic double fitness()
public void percept(int[] sig)
sig - the sensor readingspublic int[] act()
public void eat()
public void print()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||