com.antelmann.game.wolfsheep
Class WSPlayer
java.lang.Object
com.antelmann.game.TemplatePlayer
com.antelmann.game.wolfsheep.WSPlayer
- All Implemented Interfaces:
- Player, Serializable
public class WSPlayer
- extends TemplatePlayer
WSPlayer adds AI to the WolfsheepGame; can play both,
wolf and sheep.
Note: It seems that for the sheeps to win, the game
level needs to be set to 7 or higher.
If the sheeps move with sufficient intelligence, they cannot
loose; the wolf can only win based on mistakes of the sheeps.
Also, if the level is set high, the wolf tends to play too
defensively (as it anticipates the right move from the sheep
that won't let it get through, anyway), so if you want to play
against the wolf, set the level lower to make it play more
dangerous.
- Author:
- Holger Antelmann
- See Also:
WolfsheepGame,
Serialized Form
| Methods inherited from class com.antelmann.game.TemplatePlayer |
disableTracking, enableTracking, evaluate, evaluate, getlevelOverride, getMonitors, getOrderMoves, getPlayerName, getSearchOption, numberOfPositionsSearched, numberOfRequests, performanceRatio, pruneMove, setlevelOverride, setOrderMoves, setPlayerName, setSearchOption, setTracking, statsAsString, toString, totalTimeTaken, trackingEnabled |
WSPlayer
public WSPlayer()
WSPlayer
public WSPlayer(String name)
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
selectMove
public GameMove selectMove(GamePlay game,
int[] role,
int level,
long milliseconds)
- overridden to provide a sensible opening that doesn't suffer from
the horizon effect
- Specified by:
selectMove in interface Player- Overrides:
selectMove in class TemplatePlayer
- See Also:
TemplatePlayer.Synchronizer,
TemplatePlayer.MoveEvaluater
heuristic
public double heuristic(GamePlay game,
GameMove move,
int[] role)
- only cares for the first given role in the role array
- See Also:
TemplatePlayer
wolfHeuristic
protected double wolfHeuristic(WolfsheepGame game,
int[] role)
sheepHeuristic
protected double sheepHeuristic(WolfsheepGame game,
int[] role)
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads