org.moyoman.comm.client
Class MoyomanPlayer

java.lang.Object
  |
  +--org.moyoman.comm.client.Player
        |
        +--org.moyoman.comm.client.ValidatedPlayer
              |
              +--org.moyoman.comm.client.MoyomanPlayer
Direct Known Subclasses:
InteractiveComputerPlayer

public class MoyomanPlayer
extends ValidatedPlayer

The MoyomanPlayer is a Player class which uses the Moyoman server to play.


Field Summary
(package private)  CommandExecutor ce
          The CommandExecutor object which is used for executing commands on the server.
(package private)  String id
          The id of the game.
 
Fields inherited from class org.moyoman.comm.client.Player
color, handicap
 
Constructor Summary
protected MoyomanPlayer(Color c, Handicap h, CommandExecutor ce, GameId gid)
          Create a new MoyomanPlayer object to resume an existing game.
protected MoyomanPlayer(Color c, Handicap h, Mode m, CommandExecutor ce)
          Create a new MoyomanPlayer object.
 
Method Summary
 void derivedMakeMove(MoveDescriptor md)
          Make a move.
 MoveDescriptor derivedRequestMove()
          Request a move.
 Debug[] getDebuggingInfo(String name, DebugType[] types)
          Get the debug objects for the module type.
 GameRecord getGameRecord()
          Get a game record from the server.
 String getId()
          Return the id for this game.
 String getIdentifyingInfo()
          Return a string which identifies the user.
 short getMoveNumber()
          Get the move number.
 MoveDescriptor getSuggestedMove()
          Get the suggested move from the server.
 boolean isSelfInitializingUser()
          Indicate this this player does not require initialization for loading a game.
 String[] listDebuggingModules(DebugType[] types)
          The types parameter acts as a filter, so that modules which only have debugging information that the client will not understand are not on the list.
 BooleanResponse requestResignation()
          Request that the server resigns the game.
 void setProperties(Properties props)
          Set the properties for this player.
 
Methods inherited from class org.moyoman.comm.client.ValidatedPlayer
isValidatedUser
 
Methods inherited from class org.moyoman.comm.client.Player
getColor, getHandicap, makeMove, makeMoveNoEvents, registerEndOfGameMoveListener, registerMakeMoveListener, registerRequestMoveListener, requestMove, unregisterEndOfGameListeners, unregisterMakeMoveListeners, unregisterRequestMoveListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

String id
The id of the game.


ce

CommandExecutor ce
The CommandExecutor object which is used for executing commands on the server.

Constructor Detail

MoyomanPlayer

protected MoyomanPlayer(Color c,
                        Handicap h,
                        Mode m,
                        CommandExecutor ce)
                 throws InternalErrorException
Create a new MoyomanPlayer object.

Parameters:
c - - The color of this player.
h - - The handicap for this player.
m - - The mode for this player.
ce - - The CommandExecutor object for this player.
Throws:
InternalErrorException - - Thrown if an error occurs for any reason.

MoyomanPlayer

protected MoyomanPlayer(Color c,
                        Handicap h,
                        CommandExecutor ce,
                        GameId gid)
                 throws InternalErrorException
Create a new MoyomanPlayer object to resume an existing game.

Parameters:
c - - The color of this player.
h - - The handicap for this player.
ce - - The CommandExecutor object for this player.
gid - - The id of the game.
Throws:
InternalExceptionError - - Thrown if an error occurs for any reason.
InternalErrorException
Method Detail

derivedMakeMove

public void derivedMakeMove(MoveDescriptor md)
                     throws IllegalMoveException,
                            InternalErrorException
Make a move.

Specified by:
derivedMakeMove in class Player
Parameters:
md - The MoveDescriptor which describes the move to make.
Throws:
Exception - Thrown if the operation fails.
IllegalMoveException - - Thrown if the move is illegal.
InternalExceptionError - - Thrown if an error occurs for any reason.
InternalErrorException - Thrown if the operation fails for any reason.

derivedRequestMove

public MoveDescriptor derivedRequestMove()
                                  throws IllegalMoveException,
                                         InternalErrorException
Request a move.

Specified by:
derivedRequestMove in class Player
Returns:
A MoveDescriptor object which describes the move.
Throws:
IllegalMoveException - - Thrown if the move is illegal.
InternalExceptionError - - Thrown if an error occurs for any reason.
InternalErrorException - Thrown if the operation fails for any reason.

getDebuggingInfo

public Debug[] getDebuggingInfo(String name,
                                DebugType[] types)
                         throws NoSuchDataException,
                                InternalErrorException
Get the debug objects for the module type. Only those debug objects which use the supported debug types are returned.

Parameters:
name - - The name of the module.
types - - The debug types which the caller supports.
Returns:
An array of Debug objects.
Throws:
NoSuchDataException - - Thrown if the name does not correspond to an actual module.
InternalExceptionError - - Thrown if an error occurs for any reason.
InternalErrorException

getGameRecord

public GameRecord getGameRecord()
                         throws InternalErrorException
Get a game record from the server.

Specified by:
getGameRecord in class Player
Returns:
The GameRecord object.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

setProperties

public void setProperties(Properties props)
                   throws InternalErrorException
Set the properties for this player. This is meant to be used primarily for special modes, such as testing, or training a module which learns.

Parameters:
props - The Properties object. The meaning of the properties are specific to individual module implementations.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

getSuggestedMove

public MoveDescriptor getSuggestedMove()
                                throws Exception
Get the suggested move from the server.

Returns:
The SuggestedMove object.
Throws:
Exception - Thrown if the operation fails.

listDebuggingModules

public String[] listDebuggingModules(DebugType[] types)
                              throws InternalErrorException
The types parameter acts as a filter, so that modules which only have debugging information that the client will not understand are not on the list.

Parameters:
types - A filter which indicates the desired Debug types.
Returns:
An array of all of the module names with debug information.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

requestResignation

public BooleanResponse requestResignation()
                                   throws InternalErrorException
Request that the server resigns the game.

Returns:
A BooleanResponse object.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

getMoveNumber

public short getMoveNumber()
                    throws InternalErrorException
Get the move number.

Specified by:
getMoveNumber in class Player
Returns:
A short which is the move number to be played next.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

isSelfInitializingUser

public boolean isSelfInitializingUser()
Indicate this this player does not require initialization for loading a game.

Specified by:
isSelfInitializingUser in class Player
Returns:
true.

getIdentifyingInfo

public String getIdentifyingInfo()
Return a string which identifies the user.

Specified by:
getIdentifyingInfo in class Player
Returns:
An identifying string.

getId

public String getId()
Return the id for this game.

Specified by:
getId in class Player
Returns:
The id.