|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AutoPlay
AutoPlay adds AI capabilites to a GamePlay by mapping Player objects
to the game roles of a GamePlay. This enables
to play against/with automated and intelligent opponents.
This also provides the basis for any type of automated game simulation.
A word on the association of Player objects to GamePlay objects:
A GamePlay object (read: a game) has a certain number of 'game roles',
each role can be assigned to a player. It is, however, possible that one
Player object plays more than just one role in a given game (to account
for any type of game setup). This is why - when dealing with game roles -
an array of game roles is passed on instead of just one game role.
Player,
GamePlay| Method Summary | |
|---|---|
GameMove |
autoMove()
autoMove() carries out the next best move for the game and returns it; null is returned if no move was carried out. |
Player |
changePlayer(int gameRole,
Player player)
changePlayer() enables to change the Player for a gameRole while the game is in progress; the old Player object is returned |
double |
evaluateMove(GameMove move)
The evaluation of the move is usually carried out by the Player object who plays the given move; consequently, the result should be interpreted from the perspective of the game roles this particular Player plays in the game. |
GamePlay |
getGame()
returns the underlying GamePlay object |
int |
getLevel()
returns the game level |
Player |
getPlayer(int gameRole)
getPlayer(gameRole) returns the corresponding Player to the given gameRole - an integer between 0 and (getNumberOfPlayers()-1). |
Player[] |
getPlayers()
returns all Player objects that play the game; there may be duplicate Player objects present |
GameMove |
getRandomLegalMove()
returns a random legal move or null if no legal moves are available |
long |
getResponseTime()
returns the response time that is used by the following functions: hint() evaluateMove() autoMove() |
int[] |
getRoles(Player player)
Players could play multiple roles in a game, so getRoles returns an array of Integers. |
GameMove |
hint(int playerRole)
hint(int) delegates the evaluation of the best move to make to the Player object associated to the playerRole. |
void |
setLevel(int level)
The level in the game represents the 'depth' of the search tree (number of subsequent moves) a Player potentially searches through the game tree to evaluate a move. |
void |
setResponseTime(long milliseconds)
sets the desired response time for the following functions: hint() evaluateMove() autoMove() A value of 0 indicates that the response time is only driven by getLevel(). |
| Method Detail |
|---|
GamePlay getGame()
void setLevel(int level)
int getLevel()
setLevel(int)GameMove autoMove()
Player getPlayer(int gameRole)
Player[] getPlayers()
Player changePlayer(int gameRole,
Player player)
throws CannotPlayGameException
CannotPlayGameExceptionint[] getRoles(Player player)
void setResponseTime(long milliseconds)
long getResponseTime()
GameMove hint(int playerRole)
double evaluateMove(GameMove move)
GameMove getRandomLegalMove()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||