com.brackeen.javagamebook.ai
Class EvolutionGenePool

java.lang.Object
  extended bycom.brackeen.javagamebook.ai.EvolutionGenePool

public class EvolutionGenePool
extends java.lang.Object

The EvolutionGenePool class keeps track of a collection of Brains. When an EvolutionBot is created, it requests a Brain from the gene pool. The Brain is either one of the brains in the collection, or a mutation of one of the brains. Only the top brains are collected, ranked by the amount of damage a brain's bot caused. There for, only the best brains reproduce.


Constructor Summary
EvolutionGenePool(BSPTree bspTree)
           
 
Method Summary
 Brain getNewBrain()
          Gets a new brain from the gene pool.
 Brain getRandomTopBrain()
          Gets a random top-performing brain.
 void notifyDead(Brain brain, long damageCaused)
          Notify that a creature with the specified brain has been destroyed.
 void resetEvolution()
           
 void setBSPTree(BSPTree bspTree)
          The BSP tree used for certain patterns (like the shortest path alogirthm used for the chase pattern)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EvolutionGenePool

public EvolutionGenePool(BSPTree bspTree)
Method Detail

setBSPTree

public void setBSPTree(BSPTree bspTree)
The BSP tree used for certain patterns (like the shortest path alogirthm used for the chase pattern)


resetEvolution

public void resetEvolution()

getNewBrain

public Brain getNewBrain()
Gets a new brain from the gene pool. The brain will either be a "top" brain or a new, mutated "top" brain.


getRandomTopBrain

public Brain getRandomTopBrain()
Gets a random top-performing brain.


notifyDead

public void notifyDead(Brain brain,
                       long damageCaused)
Notify that a creature with the specified brain has been destroyed. The brain's stats aer recorded. If the brain's stats are within the top


toString

public java.lang.String toString()