|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dartra.standard.PersistentObject
org.dartra.standard.StandardGame
org.dartra.games.cricket.CricketGame
CricketGame implementation
Field Summary | |
protected static java.lang.String[] |
DEFAULT_GOALS
|
protected java.util.Hashtable |
goalsMap
|
Constructor Summary | |
|
CricketGame(StandardBoard board,
Player[] players,
boolean usePoints)
|
|
CricketGame(StandardBoard board,
Player[] players,
StringProperties props)
|
protected |
CricketGame(java.lang.String name,
StandardBoard board,
Player[] players,
boolean usePoints)
|
protected |
CricketGame(java.lang.String name,
StandardBoard board,
Player[] players,
boolean usePoints,
java.lang.String[] goals)
|
protected |
CricketGame(java.lang.String name,
StandardBoard board,
Player[] players,
StringProperties props)
|
Method Summary | |
protected void |
addHitToTracker(Player player,
java.util.Hashtable goalsTracker,
java.util.Hashtable scoreTracker,
Hit hit)
|
protected void |
addPlayerThrow(Zone hitTargetZone,
Hit hit)
|
void |
addTurnToTracker(Turn turn,
java.util.Hashtable goalsTracker,
java.util.Hashtable scoreTracker)
|
protected Player |
calculateWinner()
|
protected void |
changePlayer()
|
protected java.util.Hashtable |
createTracker()
|
protected boolean |
emptyTurn(Turn turn)
|
protected int |
findPlace(int numberThrown)
|
protected boolean |
gameOver()
|
java.lang.String[] |
getGoals()
|
java.util.Hashtable |
getGoalsMap()
|
Objective |
getObjective()
Get the current objective of the game: the current player should try to hit a zone of the board, or should end this turn. |
Score |
getPlayerScore(Player player)
Get the current score for given player in this game. |
StringProperties |
getProperties()
Subclasses should implement this to properly return their game specific properties (for instance the "start score" for an x01 game). |
protected int |
highestScoreNumber(Player player)
|
protected Zone |
highestScoreZone(Player player)
|
protected boolean |
isClosedByOtherPlayer(int number,
Player player)
|
protected boolean |
isClosedByPlayer(int number,
Player player)
|
boolean |
isUsePoints()
|
int |
multiplierToClose(int number,
Player player)
|
void |
registerHit(Zone targetZone,
Hit hit)
Register the hit of a dart on the board. |
int |
score(int[] scoreTracker)
|
void |
setGoals(java.lang.String[] newGoals)
|
void |
setUsePoints(boolean b)
|
protected Zone |
suggestZone(int number,
int multiplier)
|
java.lang.String |
toString()
|
protected boolean |
turnOver()
|
protected boolean |
wasClosedByOtherPlayer(java.util.Hashtable goalsTracker,
int place,
Player player)
|
protected boolean |
wasClosedByPlayer(java.util.Hashtable goalsTracker,
int place,
Player player)
|
protected Zone |
zoneToCloseHighestOpenForPlayer(Player player)
|
Methods inherited from class org.dartra.standard.StandardGame |
accept, addGameEventListener, addTurn, getBoard, getCurrentPlayer, getCurrentTurn, getEndTime, getFirstPlayer, getGameEventListeners, getName, getPlayer, getPlayers, getPlayerTurn, getPlayerTurnHistory, getStartTime, getTurn, getTurnHistory, getWinner, removeGameEventListener, setEndTime, setFirstPlayer, setPlayers, setStartTime, setWinner, start, undoHit |
Methods inherited from class org.dartra.standard.PersistentObject |
getId, setId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.dartra.framework.Persistent |
getId, setId |
Field Detail |
protected static final java.lang.String[] DEFAULT_GOALS
protected java.util.Hashtable goalsMap
Constructor Detail |
public CricketGame(StandardBoard board, Player[] players, boolean usePoints)
public CricketGame(StandardBoard board, Player[] players, StringProperties props)
protected CricketGame(java.lang.String name, StandardBoard board, Player[] players, boolean usePoints)
protected CricketGame(java.lang.String name, StandardBoard board, Player[] players, boolean usePoints, java.lang.String[] goals)
protected CricketGame(java.lang.String name, StandardBoard board, Player[] players, StringProperties props)
Method Detail |
public Objective getObjective()
Game
Get the current objective of the game: the current player should try to hit a zone of the board, or should end this turn.
Game.getObjective()
public void registerHit(Zone targetZone, Hit hit)
Game
Register the hit of a dart on the board. A particular zone of the board was targetted.
Game.registerHit(org.dartra.framework.Zone, org.dartra.framework.Hit)
public Score getPlayerScore(Player player)
Game
Get the current score for given player in this game.
Game.getPlayerScore(org.dartra.framework.Player)
public java.lang.String toString()
toString
in class StandardGame
public StringProperties getProperties()
StandardGame
Subclasses should implement this to properly return their game specific properties (for instance the "start score" for an x01 game).
It is legal to return null if there are no game specific properties.
getProperties
in class StandardGame
public int score(int[] scoreTracker)
protected java.util.Hashtable createTracker()
public void addTurnToTracker(Turn turn, java.util.Hashtable goalsTracker, java.util.Hashtable scoreTracker)
protected void addHitToTracker(Player player, java.util.Hashtable goalsTracker, java.util.Hashtable scoreTracker, Hit hit)
protected boolean wasClosedByOtherPlayer(java.util.Hashtable goalsTracker, int place, Player player)
protected boolean wasClosedByPlayer(java.util.Hashtable goalsTracker, int place, Player player)
protected int findPlace(int numberThrown)
protected void addPlayerThrow(Zone hitTargetZone, Hit hit)
protected Zone zoneToCloseHighestOpenForPlayer(Player player)
protected Zone suggestZone(int number, int multiplier)
protected Zone highestScoreZone(Player player)
protected boolean isClosedByPlayer(int number, Player player)
protected boolean isClosedByOtherPlayer(int number, Player player)
protected int highestScoreNumber(Player player)
public int multiplierToClose(int number, Player player)
protected boolean emptyTurn(Turn turn)
protected boolean gameOver()
protected Player calculateWinner()
protected boolean turnOver()
protected void changePlayer()
public java.lang.String[] getGoals()
public boolean isUsePoints()
public void setUsePoints(boolean b)
public void setGoals(java.lang.String[] newGoals)
public java.util.Hashtable getGoalsMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |