public class Genome
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
ageLimit |
private static Genome |
carnivoreGenome |
private int |
DEFAULT_MUTATION_RATE |
private int |
gestation |
private static Genome |
herbivoreGenome |
private int |
maturityAge |
private int |
metabolism |
private int |
mutationRate |
private java.util.Random |
random |
private int |
reproductionRate |
private int |
reproductiveEnergy |
private int |
sight |
private int |
speed |
private int |
stamina |
private int |
strength |
Constructor and Description |
---|
Genome()
The default constructor provides a standard genome.
|
Genome(Genome parentGenome)
This constructor creates a new genome based on the parent genome passed
to it, mutating it at random.
|
Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
This constructor creates a genome from a HashMap.
|
Genome(int mutationRate,
int speed,
int stamina,
int sight,
int metabolism,
int ageLimit,
int strength,
int reproductiveEnergy,
int maturityAge,
int gestation,
int reproductionRate)
This constructor creates a genome from the values passed to it.
|
Modifier and Type | Method and Description |
---|---|
java.util.HashMap<java.lang.String,java.lang.Integer> |
asHashMap()
Return all the "genes" of this genome in a single HashMap.
|
private void |
checkGenome()
Check to make sure that no "gene" has a value below zero
|
int |
getAgeLimit() |
int |
getGestation() |
int |
getMaturityAge() |
int |
getMetabolism() |
int |
getMutationRate() |
int |
getReproductionRate() |
int |
getReproductiveEnergy() |
int |
getSight() |
int |
getSpeed() |
int |
getStamina() |
int |
getStrength() |
private int |
mutation(int coefficient)
Returns a mutation factor depending on the specified mutation rate.
|
private int mutationRate
private int speed
private int stamina
private int sight
private int metabolism
private int ageLimit
private int strength
private int reproductiveEnergy
private int maturityAge
private int gestation
private int reproductionRate
private final int DEFAULT_MUTATION_RATE
private static Genome herbivoreGenome
private static Genome carnivoreGenome
private java.util.Random random
public Genome()
public Genome(Genome parentGenome)
public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, int ageLimit, int strength, int reproductiveEnergy, int maturityAge, int gestation, int reproductionRate)
public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
private int mutation(int coefficient)
coefficient
- Influences the size of the returned factor.private void checkGenome()
public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
public int getMutationRate()
public int getSpeed()
public int getStamina()
public int getSight()
public int getMetabolism()
public int getAgeLimit()
public int getStrength()
public int getReproductiveEnergy()
public int getMaturityAge()
public int getGestation()
public int getReproductionRate()