heurgame
Class DefaultReferee

java.lang.Object
  extended byheurgame.Referee
      extended byheurgame.DefaultReferee
All Implemented Interfaces:
GameListener, TurnListener

public class DefaultReferee
extends Referee

Author:
David Kaplin This referee is abstract enough to work with most turn-based games. Alone, it knows nothing of the rules of the game. To decide such manners it negotiates with the System and Move Analyzers. It also notifies the Game itself of certain events so that they can be broadcast to all listensers. This Referee works with the players directly and acts as a facade to keep them from interacting with the raw game logic.

Constructor Summary
DefaultReferee()
           
 
Method Summary
 void addPlayer(PlayerProxy p)
          Adds a new player, should trigger the game to send a player event.
 void gameEnded(GameEvent e)
          In the case of a decisive victory informs the players if they have won.
 void gameSetup(GameEvent e)
          Allows access to the game before the game starts
 void gameStarted(GameEvent e)
          Sends all Players the intial information.
 void rejectAllPlayers()
          The quick way to force a game reset.
 void reportIncrementalStatus()
          Reports the latest change in the game to all players
 void reportStatus(PlayerToken doNotInform)
          Reports the state of the game to all players execpt a particular one
 void turnChanged(TurnEvent e)
          Where we look at the moves
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultReferee

public DefaultReferee()
Method Detail

addPlayer

public void addPlayer(PlayerProxy p)
Description copied from class: Referee
Adds a new player, should trigger the game to send a player event.

Specified by:
addPlayer in class Referee
Parameters:
p - the new player attached to the game.
See Also:
Referee.addPlayer(heurgame.PlayerProxy)

gameSetup

public void gameSetup(GameEvent e)
Allows access to the game before the game starts

Parameters:
e - May have some specific setup information
See Also:
GameListener.gameSetup(heurgame.event.GameEvent)

gameStarted

public void gameStarted(GameEvent e)
Sends all Players the intial information.

Parameters:
e - additional information
See Also:
GameListener.gameStarted(heurgame.event.GameEvent)

gameEnded

public void gameEnded(GameEvent e)
In the case of a decisive victory informs the players if they have won. Othewise it informs the players who have tied. Finally it informs the players that have lost.

Parameters:
e - additional information
See Also:
GameListener.gameEnded(heurgame.event.GameEvent)

reportStatus

public void reportStatus(PlayerToken doNotInform)
Description copied from class: Referee
Reports the state of the game to all players execpt a particular one

Specified by:
reportStatus in class Referee
Parameters:
doNotInform - not told status

reportIncrementalStatus

public void reportIncrementalStatus()
Description copied from class: Referee
Reports the latest change in the game to all players

Specified by:
reportIncrementalStatus in class Referee

turnChanged

public void turnChanged(TurnEvent e)
Where we look at the moves

See Also:
TurnListener.turnChanged(heurgame.event.TurnEvent)

rejectAllPlayers

public void rejectAllPlayers()
Description copied from class: Referee
The quick way to force a game reset.

Specified by:
rejectAllPlayers in class Referee
See Also:
Referee.rejectAllPlayers()