|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Player
The Player ojbect adds Artificial Intelligence to a GamePlay. The association between the game roles of a GamePlay and a Player object is done through the AutoPlay interface.
TemplatePlayer,
AutoPlay,
SocketPlayer,
SocketPlayerServer| Method Summary | |
|---|---|
boolean |
canPlayGame(GamePlay game)
canPlayGame() returns true only if the Player provides an applicable heuristic for the type of game given. |
double |
evaluate(GamePlay game,
GameMove move,
int[] role,
int level,
long milliseconds)
evaluate() asks the Player to rate a move in the context of a given game stage relative to its role (if the Player has multiple roles in the game, they will all be found in the role array - giving the Player maximum flexibility) while considering the game level for potential game tree search operations and then using heuristic() to evaluate the leaves of the game tree. |
java.lang.String |
getPlayerName()
|
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)
This method allows the Player to prune a game tree branch by determining that a particular move is not to be considered for further recursive tree search; this method is expected to return quickly. |
GameMove |
selectMove(GamePlay game,
int[] role,
int level,
long milliseconds)
selectMove() asks the Player to select a move out of GamePlay.legalMove() based on the role it plays; milliseconds is an indication of how long the calling function is willing to wait for an answer before continuing with potentially a randomMove or something else. |
| Method Detail |
|---|
java.lang.String getPlayerName()
boolean canPlayGame(GamePlay game)
//Example:
if (game instanceof MyGameClass) return true; else return false;
// or:
if (game.getClass() == myFavoriteGame.getClass()) return true; else return false;
double evaluate(GamePlay game,
GameMove move,
int[] role,
int level,
long milliseconds)
throws CannotPlayGameException,
GameRuntimeException
GameRuntimeException - if the move is not a legal move
CannotPlayGameException - if the game cannot be played by the playerGameUtils,
TemplatePlayer,
GamePlay.getResult(int)
double heuristic(GamePlay game,
GameMove move,
int[] role)
throws CannotPlayGameException,
GameRuntimeException
GameRuntimeException - if the move is not a legal move
CannotPlayGameException - if the game cannot be played by the playerTemplatePlayer
GameMove selectMove(GamePlay game,
int[] role,
int level,
long milliseconds)
throws CannotPlayGameException
CannotPlayGameExceptionTemplatePlayer
boolean pruneMove(GamePlay game,
GameMove move,
int[] role)
By default, this method should always return false unless there is a good reason found by a Player to dismiss the tree branch emerging from this move.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||