org.vizzini.example.tictactoe
Class TicTacToeGeneticAlgorithm

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
      extended by org.vizzini.game.boardgame.AbstractGameGeneticAlgorithm
          extended by org.vizzini.example.tictactoe.TicTacToeGeneticAlgorithm
All Implemented Interfaces:
IGameGeneticAlgorithm, IGeneticAlgorithm

public class TicTacToeGeneticAlgorithm
extends AbstractGameGeneticAlgorithm

Provides a game genetic algorithm for tic-tac-toe. This algorithm breeds neural network evaluators using game agent competition.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
 
Fields inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
_crossoverFraction, _crossoverType, _elapsedTime, _generation
 
Constructor Summary
TicTacToeGeneticAlgorithm(boolean isBoardPrinted)
          Construct this object using the given parameters.
 
Method Summary
protected  IComputerAgent createAgent0()
          Create agent 0.
protected  IComputerAgent createAgent1()
          Create agent 1.
protected  IChromosome createChromosome()
          Create a new chromosome.
protected  INeuralNetwork createNeuralNetworkExemplar()
          Fill the population with random chromosomes.
protected  void fillPopulation()
          Fill the population with random chromosomes.
protected  String getGamePropertiesPath()
          Return the game properties path.
protected  String getNeuralNetworkFilepath()
          Return the neural network filepath.
static void main(String[] args)
          Application method.
 
Methods inherited from class org.vizzini.game.boardgame.AbstractGameGeneticAlgorithm
configureAgent, createGame, evaluateFitness, getFitnessLoss, getFitnessTie, getFitnessWin, getGame, getMaxOpponentCount, isVerbose, rewardAndPunish, setAgent0, setAgent1, setFitnessLoss, setFitnessTie, setFitnessWin, setGame, setTurnNumberConsidered, setVerbose, toString, zeroCounts
 
Methods inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
averageCrossover, generateNewPopulation, getAverageCrossoverFraction, getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPerfectFitness, getPopulation, getPopulationSize, getProcessingRate, isDuplicateAllowed, mutation, onePointCrossover, reproductionAndCrossover, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulation, setPopulationSize, sortPopulation, uniformCrossover, writeReport, writeStats, writeStatsHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.ai.geneticalgorithm.IGeneticAlgorithm
getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPopulationSize, getProcessingRate, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulationSize, writeReport
 

Constructor Detail

TicTacToeGeneticAlgorithm

public TicTacToeGeneticAlgorithm(boolean isBoardPrinted)
                          throws InstantiationException,
                                 IllegalAccessException
Construct this object using the given parameters.

Parameters:
isBoardPrinted - Flag indicating whether to print the board when triggered by state changes.
Throws:
InstantiationException
IllegalAccessException
Since:
v0.1
Method Detail

main

public static void main(String[] args)
                 throws Exception
Application method.

Parameters:
args - 0-population size (optional)
1-number of generations to run (optional)
2-print frequency (optional)
Throws:
Exception
Since:
v0.1

createAgent0

protected IComputerAgent createAgent0()
Create agent 0.

Specified by:
createAgent0 in class AbstractGameGeneticAlgorithm
Since:
v0.1

createAgent1

protected IComputerAgent createAgent1()
Create agent 1.

Specified by:
createAgent1 in class AbstractGameGeneticAlgorithm
Since:
v0.1

createChromosome

protected IChromosome createChromosome()
Create a new chromosome.

Specified by:
createChromosome in class AbstractGeneticAlgorithm
Since:
v0.2

createNeuralNetworkExemplar

protected INeuralNetwork createNeuralNetworkExemplar()
Fill the population with random chromosomes.

Since:
v0.1

fillPopulation

protected void fillPopulation()
Fill the population with random chromosomes.

Overrides:
fillPopulation in class AbstractGeneticAlgorithm
Since:
v0.1

getGamePropertiesPath

protected String getGamePropertiesPath()
Return the game properties path.

Specified by:
getGamePropertiesPath in class AbstractGameGeneticAlgorithm
Since:
v0.1

getNeuralNetworkFilepath

protected String getNeuralNetworkFilepath()
Return the neural network filepath.

Since:
v0.1


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02