com.antelmann.game.awari
Class AwariPlayer
java.lang.Object
com.antelmann.game.TemplatePlayer
com.antelmann.game.awari.AwariPlayer
- All Implemented Interfaces:
- Player, Serializable
public class AwariPlayer
- extends TemplatePlayer
AwariPlayer adds AI to the AwariGame
- Author:
- Holger Antelmann
- See Also:
AwariGame,
Serialized Form
|
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. |
void |
setRandomSeed(long seed)
randomizes the heuristics with the given seed. |
| Methods inherited from class com.antelmann.game.TemplatePlayer |
disableTracking, enableTracking, evaluate, evaluate, getlevelOverride, getMonitors, getOrderMoves, getPlayerName, getSearchOption, numberOfPositionsSearched, numberOfRequests, performanceRatio, pruneMove, selectMove, setlevelOverride, setOrderMoves, setPlayerName, setSearchOption, setTracking, statsAsString, toString, totalTimeTaken, trackingEnabled |
AwariPlayer
public AwariPlayer()
AwariPlayer
public AwariPlayer(String name)
setRandomSeed
public void setRandomSeed(long seed)
- randomizes the heuristics with the given seed.
By default, randomization is disabled; you can
disable randomization through this method by
using 0 as the seed parameter. Every other number
will initialize the internal randomizer.
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;
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
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads