Class StringOrganism
- java.lang.Object
-
- com.garrettAndPeter.lib.Organism<java.lang.String>
-
- com.garrettAndPeter.stringEvolution.StringOrganism
-
public class StringOrganism extends Organism<java.lang.String>
An organism based off of a string The string organism is implemented to show how words can evolve based on a certain target word. A strings fitness is increased for every character that it has in common with the target string.
-
-
Constructor Summary
Constructors Constructor Description StringOrganism(Generator<java.lang.String> g)
StringOrganism(Organism<java.lang.String> a, Organism<java.lang.String> b)
StringOrganism(java.lang.String d)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> double
calculateFitness(T target)
Calculate how fit (how likely it is for this organism to reproduce) based on a target.-
Methods inherited from class com.garrettAndPeter.lib.Organism
generateFitness, getData, getFitness
-
-
-
-
Method Detail
-
calculateFitness
public <T> double calculateFitness(T target)
Description copied from class:Organism
Calculate how fit (how likely it is for this organism to reproduce) based on a target. organisms closer to a target should have higher fitness values- Specified by:
calculateFitness
in classOrganism<java.lang.String>
-
-