Package simulation
Class FastPopulationMember
java.lang.Object
simulation.Movable
simulation.PopulationMember
simulation.FastPopulationMember
- All Implemented Interfaces:
Drawable
public class FastPopulationMember extends PopulationMember
Class describing behaviour of fast PopulationMember.
-
Constructor Summary
Constructors Constructor Description FastPopulationMember(PopulationMember pm1, PopulationMember pm2)
Create new object from crossover of 2 already existing objects.FastPopulationMember(Vector diameters)
Creates new FastPopulationMember 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
-
FastPopulationMember
Creates new FastPopulationMember object with given diameters.- Parameters:
diameters
- Vector containing size in pixels of this species.
-
FastPopulationMember
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.
-