JGAP

examples.gp.tictactoe
Class TicTacToeMain.GameFitnessFunction

java.lang.Object
  extended by org.jgap.gp.GPFitnessFunction
      extended by examples.gp.tictactoe.TicTacToeMain.GameFitnessFunction
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
TicTacToeMain

public static class TicTacToeMain.GameFitnessFunction
extends GPFitnessFunction

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jgap.gp.GPFitnessFunction
MAX_FITNESS_VALUE, NO_FITNESS_VALUE
 
Constructor Summary
TicTacToeMain.GameFitnessFunction(Board a_board, int a_color, GPGenotype a_other, int a_otherColor)
           
 
Method Summary
 double computeRawFitness(IGPProgram a_program)
           
protected  double evaluate(IGPProgram a_subject)
          Determine the fitness of the given GPProgram instance.
 void setOpponent(GPGenotype a_other)
           
 void setPlayer(GPGenotype a_player)
           
 
Methods inherited from class org.jgap.gp.GPFitnessFunction
getFitnessValue, getLastComputedFitnessValue, GPFitnessFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TicTacToeMain.GameFitnessFunction

public TicTacToeMain.GameFitnessFunction(Board a_board,
                                         int a_color,
                                         GPGenotype a_other,
                                         int a_otherColor)
Method Detail

setPlayer

public void setPlayer(GPGenotype a_player)

setOpponent

public void setOpponent(GPGenotype a_other)

evaluate

protected double evaluate(IGPProgram a_subject)
Description copied from class: GPFitnessFunction
Determine the fitness of the given GPProgram instance. The higher the return value, the more fit the instance. This method should always return the same fitness value for two equivalent GPProgram instances.

Specified by:
evaluate in class GPFitnessFunction
Parameters:
a_subject - the GPProgram instance to evaluate
Returns:
positive double reflecting the fitness rating of the given GPProgram. Note that if a non-positive double is returned, a RuntimeException should be generated

computeRawFitness

public double computeRawFitness(IGPProgram a_program)

JGAP