Package simulation
Class SlowPopulationMember
java.lang.Object
simulation.Movable
simulation.PopulationMember
simulation.SlowPopulationMember
- All Implemented Interfaces:
Drawable
public class SlowPopulationMember extends PopulationMember
Class describing behaviour of slow PopulationMember.
-
Constructor Summary
Constructors Constructor Description SlowPopulationMember(PopulationMember pm1, PopulationMember pm2)
Create new object from crossover of 2 already existing objects.SlowPopulationMember(Vector diameters)
Creates new SlowPopulationMember object with given diameters. -
Method Summary
Modifier and Type Method Description double
calcFitness()
Calculate fitness of this object.void
draw(javafx.scene.canvas.GraphicsContext gc)
Function required to draw spmething on the screen.Methods inherited from class simulation.PopulationMember
getDna, getFitness, getHeight, getInitialVelocity, getObstacles, getStartCoordinates, getWidth, isDead, isNaturalDead, setDead, setDna, setFitness, setHeight, setNaturalDead, setWidth
Methods inherited from class simulation.Movable
addVelocity, getVelocity, multiply, multiply, setVelocity
-
Constructor Details
-
SlowPopulationMember
Creates new SlowPopulationMember object with given diameters.- Parameters:
diameters
- Vector containing size in pixels of this species.
-
SlowPopulationMember
Create new object from crossover of 2 already existing objects.- Parameters:
pm1
- First object to be used in the crossover.pm2
- Second object to be used in the crossover.
-
-
Method Details
-
calcFitness
public double calcFitness()Description copied from class:PopulationMember
Calculate fitness of this object. Fitness is a value telling how good is genetic information of this object. The bigger the value the higher the chance of this species genetic information to survive.- Specified by:
calcFitness
in classPopulationMember
- Returns:
- Fitness of this object.
-
draw
public void draw(javafx.scene.canvas.GraphicsContext gc)Description copied from interface:Drawable
Function required to draw spmething on the screen.- Parameters:
gc
- JavaFx object of class class used to issue draw calls to a Canvas using a buffer.
-