org.jscience.computing.game.fourwins
Class FourWinsPlayer

java.lang.Object
  extended by org.jscience.computing.game.TemplatePlayer
      extended by org.jscience.computing.game.fourwins.FourWinsPlayer
All Implemented Interfaces:
java.io.Serializable, Player

public class FourWinsPlayer
extends TemplatePlayer

adds AI to the FourWinsGame

See Also:
FourWinsGame, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jscience.computing.game.TemplatePlayer
TemplatePlayer.MoveEvaluater, TemplatePlayer.Synchronizer
 
Field Summary
 
Fields inherited from class org.jscience.computing.game.TemplatePlayer
levelOverwrite, monitors, orderMoves, playerName, SEARCH_ALPHABETA, SEARCH_MINMAX, searchOption
 
Constructor Summary
FourWinsPlayer()
          Creates a new FourWinsPlayer object.
FourWinsPlayer(java.lang.String name)
          Creates a new FourWinsPlayer object.
FourWinsPlayer(java.lang.String name, int searchOption, boolean trackingEnabled)
          Creates a new FourWinsPlayer object.
FourWinsPlayer(java.lang.String name, int searchOption, boolean trackingEnabled, long randomSeed)
          Creates a new FourWinsPlayer object.
 
Method Summary
 boolean canPlayGame(GamePlay game)
          DOCUMENT ME!
 void disableRandom()
          DOCUMENT ME!
 double heuristic(GamePlay game, GameMove move, int[] role)
          DOCUMENT ME!
protected  double ratePosition(FourWinsGame game, int column, int row, int player)
          DOCUMENT ME!
 GameMove selectMove(GamePlay game, int[] role, int level, long milliseconds)
          DOCUMENT ME!
 void setRandomSeed(long seed)
          if seed = 0, randomization is disabled
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.computing.game.TemplatePlayer
disableTracking, enableTracking, evaluate, evaluate, getLevelOverwrite, getMonitors, getOrderMoves, getPlayerName, getSearchOption, numberOfPositionsSearched, numberOfRequests, performanceRatio, pruneMove, setLevelOverwrite, setOrderMoves, setPlayerName, setSearchOption, setTracking, statsAsString, totalTimeTaken, trackingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FourWinsPlayer

public FourWinsPlayer()
Creates a new FourWinsPlayer object.


FourWinsPlayer

public FourWinsPlayer(java.lang.String name)
Creates a new FourWinsPlayer object.

Parameters:
name - DOCUMENT ME!

FourWinsPlayer

public FourWinsPlayer(java.lang.String name,
                      int searchOption,
                      boolean trackingEnabled)
Creates a new FourWinsPlayer object.

Parameters:
name - DOCUMENT ME!
searchOption - DOCUMENT ME!
trackingEnabled - DOCUMENT ME!

FourWinsPlayer

public FourWinsPlayer(java.lang.String name,
                      int searchOption,
                      boolean trackingEnabled,
                      long randomSeed)
Creates a new FourWinsPlayer object.

Parameters:
name - DOCUMENT ME!
searchOption - DOCUMENT ME!
trackingEnabled - DOCUMENT ME!
randomSeed - DOCUMENT ME!
Method Detail

setRandomSeed

public void setRandomSeed(long seed)
if seed = 0, randomization is disabled

Parameters:
seed - DOCUMENT ME!

disableRandom

public void disableRandom()
DOCUMENT ME!


canPlayGame

public boolean canPlayGame(GamePlay game)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!

selectMove

public GameMove selectMove(GamePlay game,
                           int[] role,
                           int level,
                           long milliseconds)
DOCUMENT ME!

Specified by:
selectMove in interface Player
Overrides:
selectMove in class TemplatePlayer
Parameters:
game - DOCUMENT ME!
role - DOCUMENT ME!
level - DOCUMENT ME!
milliseconds - DOCUMENT ME!
Returns:
DOCUMENT ME!
See Also:
TemplatePlayer.Synchronizer, TemplatePlayer.MoveEvaluater

heuristic

public double heuristic(GamePlay game,
                        GameMove move,
                        int[] role)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
move - DOCUMENT ME!
role - DOCUMENT ME!
Returns:
DOCUMENT ME!
See Also:
TemplatePlayer

ratePosition

protected double ratePosition(FourWinsGame game,
                              int column,
                              int row,
                              int player)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
column - DOCUMENT ME!
row - DOCUMENT ME!
player - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class TemplatePlayer
Returns:
DOCUMENT ME!