Class LocalPlayer

java.lang.Object
  extended by Player
      extended by LocalPlayer

public class LocalPlayer
extends Player

This class inherits from the player. This class identifies that the local player is the second player in the game.

Author:

Field Summary
 
Fields inherited from class Player
LOCALPLAYER, NETWORKPLAYER
 
Constructor Summary
LocalPlayer(int num, Rules rules, Driver theDriver)
          This is a default constructor for this object
 
Method Summary
 void acceptDraw(Player player)
          When the current player accepts a draw, this method is called in the opposite player to inform them that the draw has been accepted.
 void endInDeclineDraw(Player player)
          Method is invoked if the other player declines a draw.
 void endInDraw(Player player)
          Method that is invoked when the end of game conditions have been met.
 void endOfGame(java.lang.String endMessage)
          Method that is invoked when the end of game conditions have been met.
 void offerDraw(Player player)
          When the current player clicks the draw button, this method is called in the opposite player to inform them that a draw has been offered.
 
Methods inherited from class Player
getColor, getName, getNumber, getType, makeMove, setColor, setName, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalPlayer

public LocalPlayer(int num,
                   Rules rules,
                   Driver theDriver)
This is a default constructor for this object

Method Detail

offerDraw

public void offerDraw(Player player)
When the current player clicks the draw button, this method is called in the opposite player to inform them that a draw has been offered. An actionEvent is generated to let the GUI know.

Specified by:
offerDraw in class Player

acceptDraw

public void acceptDraw(Player player)
When the current player accepts a draw, this method is called in the opposite player to inform them that the draw has been accepted. An actionEvent is generated to let the GUI know and endGame is called in theDriver.

Specified by:
acceptDraw in class Player

endInDeclineDraw

public void endInDeclineDraw(Player player)
Method is invoked if the other player declines a draw.

Specified by:
endInDeclineDraw in class Player

endOfGame

public void endOfGame(java.lang.String endMessage)
Method that is invoked when the end of game conditions have been met. Fire off an action event to tell the GUI to display endMessage in a dialogue box. When the user clicks OK, call endGame in theDriver.

Specified by:
endOfGame in class Player
Parameters:
endMessage - Message indicating the end of the game.

endInDraw

public void endInDraw(Player player)
Method that is invoked when the end of game conditions have been met. If they have been, this method is called in both players to notify them of this with a message. Implementation differs for local player and network player.

Specified by:
endInDraw in class Player
Parameters:
endMessage - Message indicating the end of the game.