public class Chromosome extends java.lang.Object implements java.lang.Comparable<Chromosome>
Modifier and Type | Class and Description |
---|---|
class |
Chromosome.SpritePointData
helpful data structure to hold information about certain points in the level
|
Constructor and Description |
---|
Chromosome(int width,
int height)
initialize the chromosome with a certain length and width
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<java.lang.Double> |
calculateFitness(long time)
Calculate the current fitness of the chromosome
|
Chromosome |
clone()
clone the chromosome data
|
int |
compareTo(Chromosome o)
Compare two chromosome with each other based on their
constrained fitness and normal fitness
|
java.util.ArrayList<Chromosome> |
crossOver(Chromosome c)
crossover the current chromosome with the input chromosome
|
double |
getCombinedFitness()
Get the average value of the fitness
|
double |
getConstrainFitness()
Get constraint fitness for infeasible chromosome
|
java.util.ArrayList<java.lang.Double> |
getFitness()
Get the current chromosome fitness
|
LevelMapping |
getLevelMapping()
get the current used level mapping to parse the level string
|
java.lang.String |
getLevelString(LevelMapping levelMapping)
get the current level string
|
void |
InitializeConstructive()
initialize the chromosome using the contructive level generator
|
void |
InitializeRandom()
initialize the chromosome with random sprites
|
void |
mutate()
mutate the current chromosome
|
public Chromosome(int width, int height)
width
- height
- public Chromosome clone()
clone
in class java.lang.Object
public void InitializeRandom()
public void InitializeConstructive()
public java.util.ArrayList<Chromosome> crossOver(Chromosome c)
c
- the other chromosome to crossover withpublic void mutate()
public LevelMapping getLevelMapping()
public java.lang.String getLevelString(LevelMapping levelMapping)
levelMapping
- level mapping object to help constructing the stringpublic java.util.ArrayList<java.lang.Double> calculateFitness(long time)
time
- amount of time to evaluate the chromosomepublic java.util.ArrayList<java.lang.Double> getFitness()
public double getCombinedFitness()
public double getConstrainFitness()
public int compareTo(Chromosome o)
compareTo
in interface java.lang.Comparable<Chromosome>