com.antelmann.game.reversi
Class ReversiPlayer
java.lang.Object
com.antelmann.game.TemplatePlayer
com.antelmann.game.reversi.ReversiPlayer
- All Implemented Interfaces:
- Player, Serializable
public class ReversiPlayer
- extends TemplatePlayer
adds AI to the ReversiGame
- Author:
- Holger Antelmann
- See Also:
ReversiGame,
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 heuristic is basically counting pieces, but as long as the
game is not over, it weights the pieces differently according to
their potential for a final win. |
void |
setRandomSeed(long seed)
if seed = 0, randomization is disabled |
String |
toString()
overridden to return some information about the player |
| 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, totalTimeTaken, trackingEnabled |
borderWeight
public int borderWeight
cornerWeight
public int cornerWeight
ReversiPlayer
public ReversiPlayer()
ReversiPlayer
public ReversiPlayer(String name)
ReversiPlayer
public ReversiPlayer(String name,
int searchOption,
boolean enableLogging)
ReversiPlayer
public ReversiPlayer(String name,
int searchOption,
boolean enableLogging,
long randomSeed)
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;
setRandomSeed
public void setRandomSeed(long seed)
- if seed = 0, randomization is disabled
heuristic
public double heuristic(GamePlay game,
GameMove move,
int[] role)
- this heuristic is basically counting pieces, but as long as the
game is not over, it weights the pieces differently according to
their potential for a final win. Following this strategy, corner
tiles (as they're not alterable anymore) are rated the highest,
and border pieces are also rated higher than others.
- See Also:
TemplatePlayer
toString
public String toString()
- Description copied from class:
TemplatePlayer
- overridden to return some information about the player
- Overrides:
toString in class TemplatePlayer
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads