Glomus.Server
Class ServerPlayer

java.lang.Object
  extended by Glomus.Server.Player
      extended by Glomus.Server.ServerPlayer

public class ServerPlayer
extends Player

The Player Class is used within the Server to keep track of AI players. The Player class has cards, a location, and a character that it is playing as. The Game class uses the Player to determine if an illegal move has been made, and to communicate with the actual AI Player

See Also:
Protocol

Constructor Summary
ServerPlayer()
          Construct an unitialized ServerPlayer (must still be initialized via the initialize method before it can be used)
 
Method Summary
 java.lang.String accuse()
          Asks the ServerPlayer to make an accusation (ServerPlayers will always decline to make an accusation)
 void deletePlayer()
          Closes all I/O streams and sockets for this player.
 void forward(java.lang.String message)
          Forwards the broadcast message
 java.lang.String getAnswer()
          Asks the player to tell us all the pieces of the answer that it knows for sure
 java.lang.String refute(java.lang.String claim)
          Asks the ServerPlayer to refute a claim
 java.lang.String suggest()
          Asks the ServerPlayer to make a suggestion (which it does randomly)
 
Methods inherited from class Glomus.Server.Player
forceMove, getCards, getInit, getLocation, getName, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerPlayer

public ServerPlayer()
Construct an unitialized ServerPlayer (must still be initialized via the initialize method before it can be used)

Method Detail

suggest

public java.lang.String suggest()
Asks the ServerPlayer to make a suggestion (which it does randomly)

Overrides:
suggest in class Player
Returns:
The claim made by the player, in the form, "claim [suspect] [weapon] [room] [player]"

refute

public java.lang.String refute(java.lang.String claim)
Asks the ServerPlayer to refute a claim

Overrides:
refute in class Player
Parameters:
The - claim to refute, in the form "[suspect] [weapon] [room] [player]"
Returns:
the ability or inability of the AI player to refute the last suggestion; in the format "show" if not possible, and "show [value]" if possible

accuse

public java.lang.String accuse()
Asks the ServerPlayer to make an accusation (ServerPlayers will always decline to make an accusation)

Overrides:
accuse in class Player
Returns:
the message to broadcast to all the other players about this player's accusation; in the format "accuse" if not desired and "accuse [suspect] [weapon] [room] [player]" if desired

getAnswer

public java.lang.String getAnswer()
                           throws IllegalTurnException,
                                  TimeoutException,
                                  NetworkFailureException
Asks the player to tell us all the pieces of the answer that it knows for sure

Overrides:
getAnswer in class Player
Returns:
The suspect, weapon, and room known to be the answer (in that order)
Throws:
IllegalTurnException
TimeoutException
NetworkFailureException

forward

public void forward(java.lang.String message)
Forwards the broadcast message

Overrides:
forward in class Player
Parameters:
The - message to forward

deletePlayer

public void deletePlayer()
Closes all I/O streams and sockets for this player. This must be called for each player in a game, before the game signals that it is finished

Overrides:
deletePlayer in class Player