org.dartra.games.practice
Class TargetPracticeGame

java.lang.Object
  extended byorg.dartra.standard.PersistentObject
      extended byorg.dartra.standard.StandardGame
          extended byorg.dartra.games.practice.TargetPracticeGame
All Implemented Interfaces:
Game, Persistent
Direct Known Subclasses:
ClosestToZoneGame

public class TargetPracticeGame
extends StandardGame

Simple game of target practice: try to hit the target zone as quickly as possible.

Author:
Erwin Vervaet

Constructor Summary
  TargetPracticeGame(Board board, Player[] players, StringProperties props)
           
  TargetPracticeGame(Board board, Player[] players, Zone targetZone)
           
protected TargetPracticeGame(java.lang.String name, Board board, Player[] players, StringProperties props)
           
protected TargetPracticeGame(java.lang.String name, Board board, Player[] players, Zone targetZone)
           
 
Method Summary
protected  void changePlayer()
           
 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).
 Zone getTargetZone()
           
 void registerHit(Zone hitTargetZone, Hit hit)
          Register the hit of a dart on the board.
protected  void setTargetZone(Zone targetZone)
           
 java.lang.String toString()
           
 
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
 

Constructor Detail

TargetPracticeGame

protected TargetPracticeGame(java.lang.String name,
                             Board board,
                             Player[] players,
                             StringProperties props)

TargetPracticeGame

protected TargetPracticeGame(java.lang.String name,
                             Board board,
                             Player[] players,
                             Zone targetZone)

TargetPracticeGame

public TargetPracticeGame(Board board,
                          Player[] players,
                          StringProperties props)

TargetPracticeGame

public TargetPracticeGame(Board board,
                          Player[] players,
                          Zone targetZone)
Method Detail

setTargetZone

protected void setTargetZone(Zone targetZone)

getTargetZone

public Zone getTargetZone()

getObjective

public Objective getObjective()
Description copied from interface: 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.


registerHit

public void registerHit(Zone hitTargetZone,
                        Hit hit)
Description copied from interface: Game

Register the hit of a dart on the board. A particular zone of the board was targetted.


getPlayerScore

public Score getPlayerScore(Player player)
Description copied from interface: Game

Get the current score for given player in this game.


changePlayer

protected void changePlayer()

toString

public java.lang.String toString()
Overrides:
toString in class StandardGame

getProperties

public StringProperties getProperties()
Description copied from class: 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.

Specified by:
getProperties in class StandardGame