heurgame
Interface Game


public interface Game

Author:
David Kaplin

Method Summary
 void addGameListener(GameListener g)
           
 void addPlayerListener(PlayerListener p)
           
 void announceDisqualification(PlayerToken disqualified)
          Should broadcast that a player has forcably left the game.
 void announcePlayerLeft(PlayerToken gone)
          Should broadcast that a player has left the game.
 void announcePlayerStatus()
          Should broadcast all Player Status information to both the networked players and the User Interface
 void buildHumanClient(java.lang.String name)
          Constructs an HuClient, a Human Client that sends its commands through the games user interface.
 PlayerProxy buildPlayerProxy(java.net.Socket connection)
          Ensures that a game will construct a compatible Player Proxy.
 void endGame()
          Initiates the end of game broadcast.
 void endTurn()
          Initiates the broadcast to send the end of turn signal.
 java.lang.String getGreeting()
          Note the Initial Keyword will be sent by the Player Proxy This menthod just returns the extra information.
 HuClient[] getHumanClients()
          The interface needs a handle to the human clients.
 java.lang.String getIncrementalState()
          Returns the current incremental state
 int getMinimumPlayers()
           
 java.lang.String getName()
           
 java.lang.String getState()
          Returns the current state of the game.
 SystemAnalyzer getSystemAnalyzer()
          The SystemAnalyzer has the role of judging the entire game state.
 void playerAdded(PlayerToken token)
          Called when a player has been added
 void reorderPlayers(PlayerToken[] tokens)
          Reorder the players in a such a manner so that the next round's order follows the same order as this set of tokens
 void setReferee(Referee ref)
          Allows the game to know what referee is operating.
 void startNextTurn()
          Initiates the start of turn broadcast.
 boolean undoLastMove()
          Should supply at least one level of undo.
 

Method Detail

getName

public java.lang.String getName()
Returns:
Name of the Game :)

getMinimumPlayers

public int getMinimumPlayers()
Returns:
Minimum number of players needed for the game.

getGreeting

public java.lang.String getGreeting()
Note the Initial Keyword will be sent by the Player Proxy This menthod just returns the extra information.

Returns:
The Initial Status of the game.

getSystemAnalyzer

public SystemAnalyzer getSystemAnalyzer()
The SystemAnalyzer has the role of judging the entire game state.

Returns:
the officiating SystemAnalyzer

buildPlayerProxy

public PlayerProxy buildPlayerProxy(java.net.Socket connection)
Ensures that a game will construct a compatible Player Proxy.

Parameters:
connection - live network connection
Returns:
a constructed PlayerProxy

buildHumanClient

public void buildHumanClient(java.lang.String name)
Constructs an HuClient, a Human Client that sends its commands through the games user interface. This should construct a new HuClient that will then connect with the game server and thus be treated like any other player as far as the game's rule logic is concerned.

Parameters:
name - of the Human playing

getHumanClients

public HuClient[] getHumanClients()
The interface needs a handle to the human clients. Once the game starts, this method should return a valid array of the connected HuClients.

Returns:
array of HuClients;

getState

public java.lang.String getState()
Returns the current state of the game.

Returns:
Implementation defined

getIncrementalState

public java.lang.String getIncrementalState()
Returns the current incremental state

Returns:
Implementation defined

endTurn

public void endTurn()
Initiates the broadcast to send the end of turn signal.


endGame

public void endGame()
Initiates the end of game broadcast.


playerAdded

public void playerAdded(PlayerToken token)
Called when a player has been added

Parameters:
token - distinct to each player

startNextTurn

public void startNextTurn()
Initiates the start of turn broadcast.


undoLastMove

public boolean undoLastMove()
Should supply at least one level of undo.

Returns:
true if the move was undone.

announceDisqualification

public void announceDisqualification(PlayerToken disqualified)
Should broadcast that a player has forcably left the game.

Parameters:
disqualified - token representing the disqualified player

announcePlayerLeft

public void announcePlayerLeft(PlayerToken gone)
Should broadcast that a player has left the game.

Parameters:
gone -

announcePlayerStatus

public void announcePlayerStatus()
Should broadcast all Player Status information to both the networked players and the User Interface


reorderPlayers

public void reorderPlayers(PlayerToken[] tokens)
Reorder the players in a such a manner so that the next round's order follows the same order as this set of tokens

Parameters:
tokens - Established new order for the next round

setReferee

public void setReferee(Referee ref)
Allows the game to know what referee is operating.

Parameters:
ref - the one who is talking directly to the players

addGameListener

public void addGameListener(GameListener g)

addPlayerListener

public void addPlayerListener(PlayerListener p)