Holger's
Java API

com.antelmann.game.gomoku
Class GomokuPlayer

java.lang.Object
  extended by com.antelmann.game.TemplatePlayer
      extended by com.antelmann.game.gomoku.GomokuPlayer
All Implemented Interfaces:
Player, Serializable

public class GomokuPlayer
extends TemplatePlayer

adds AI to the GomokuGame

Author:
Holger Antelmann
See Also:
GomokuGame, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.antelmann.game.TemplatePlayer
TemplatePlayer.MoveEvaluater, TemplatePlayer.Synchronizer
 
Field Summary
 
Fields inherited from class com.antelmann.game.TemplatePlayer
levelOverride, monitors, orderMoves, playerName, SEARCH_ALPHABETA, SEARCH_MINMAX, searchOption
 
Constructor Summary
GomokuPlayer()
           
GomokuPlayer(String name)
           
 
Method Summary
 boolean canPlayGame(GamePlay game)
          canPlayGame() returns true only if the Player provides an applicable heuristic for the type of game given.
 double heuristic(GamePlay game, GameMove move, int[] role)
          This function - often used as a callback function - evaluates the given move in the context of the given game; it is expected to return quickly.
 boolean pruneMove(GamePlay game, GameMove move, int[] role)
          ignore all moves that are either at the edge or have no neighbor
protected  double ratePosition(GomokuGame game, int column, int row, int player)
          not done quite right, yet
 void setRandomSeed(long seed)
          if seed = 0, randomization is disabled
 
Methods inherited from class com.antelmann.game.TemplatePlayer
disableTracking, enableTracking, evaluate, evaluate, getlevelOverride, getMonitors, getOrderMoves, getPlayerName, getSearchOption, numberOfPositionsSearched, numberOfRequests, performanceRatio, selectMove, setlevelOverride, setOrderMoves, setPlayerName, setSearchOption, setTracking, statsAsString, toString, totalTimeTaken, trackingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GomokuPlayer

public GomokuPlayer()

GomokuPlayer

public GomokuPlayer(String name)
Method Detail

canPlayGame

public boolean canPlayGame(GamePlay game)
Description copied from interface: Player
canPlayGame() returns true only if the Player provides an applicable heuristic for the type of game given. This way, a player can control whether it can a game.
 //Example:
 if (game instanceof MyGameClass) return true; else return false;
 // or:
 if (game.getClass() == myFavoriteGame.getClass()) return true; else return false;
 


pruneMove

public boolean pruneMove(GamePlay game,
                         GameMove move,
                         int[] role)
ignore all moves that are either at the edge or have no neighbor

Specified by:
pruneMove in interface Player
Overrides:
pruneMove in class TemplatePlayer
Returns:
true only if the given move is to be pruned from the game tree search; false otherwise

heuristic

public double heuristic(GamePlay game,
                        GameMove move,
                        int[] role)
Description copied from interface: Player
This function - often used as a callback function - evaluates the given move in the context of the given game; it is expected to return quickly. This function is really the only function that contains proprietory knowlege about the game (as all other functions could be implemented generically without domain knowlege; this is why the class TemplatePlayer provides already most methods except this function for easy implementations of this interface); heuristic() asks for a heuristic of the move given the game status - treating the status as a leaf in a potential search tree (whereas evaluate() may perform a game tree search before returning a value).

See Also:
TemplatePlayer

ratePosition

protected double ratePosition(GomokuGame game,
                              int column,
                              int row,
                              int player)
not done quite right, yet


setRandomSeed

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



(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads