org.moyoman.client.cli
Class CliPlayer

java.lang.Object
  |
  +--org.moyoman.comm.client.Player
        |
        +--org.moyoman.comm.client.NonvalidatedPlayer
              |
              +--org.moyoman.client.cli.CliPlayer

public class CliPlayer
extends NonvalidatedPlayer


Field Summary
private  short moveNumber
           
 
Fields inherited from class org.moyoman.comm.client.NonvalidatedPlayer
 
Fields inherited from class org.moyoman.comm.client.Player
color, handicap
 
Constructor Summary
CliPlayer(Color c, Handicap h)
          Create the NonvalidatedPlayer object.
 
Method Summary
 String getIdentifyingInfo()
          Return a String which identifies the player.
protected  Move getRequestedMove()
          The derived class must override this method to get a move from the player.
 boolean isSelfInitializingUser()
          Return whether the player initializes itself on startup.
protected  void makeValidatedMove(MoveDescriptor md)
          The derived class must override this method to make a move.
protected  void setIllegalMoves(Stone[] moves)
          This method sets the moves that are illegal, excluding the ko.
protected  void setKo(Stone ko)
          This method sets the move that is illegal because it immediately retakes the ko.
 
Methods inherited from class org.moyoman.comm.client.NonvalidatedPlayer
derivedMakeMove, derivedRequestMove, getGameRecord, getId, getKo, getMoveNumber, isValidatedUser, validateMove
 
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

moveNumber

private short moveNumber
Constructor Detail

CliPlayer

public CliPlayer(Color c,
                 Handicap h)
          throws Exception
Create the NonvalidatedPlayer object.

Parameters:
c - The color of the player.
h - The handicap of the game.
Throws:
Exception - Thrown if the operation fails for any reason.
Method Detail

makeValidatedMove

protected void makeValidatedMove(MoveDescriptor md)
                          throws IllegalMoveException,
                                 InternalErrorException
Description copied from class: NonvalidatedPlayer
The derived class must override this method to make a move. The move has already been validated before this method is called.

Specified by:
makeValidatedMove in class NonvalidatedPlayer
Parameters:
md - The move to be made.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.
IllegalMoveException - - Thrown if the move to be made is illegal.

getRequestedMove

protected Move getRequestedMove()
Description copied from class: NonvalidatedPlayer
The derived class must override this method to get a move from the player. The move returned by this method will be validated by derivedRequestMove().

Specified by:
getRequestedMove in class NonvalidatedPlayer
Returns:
The move to be made.

setKo

protected void setKo(Stone ko)
This method sets the move that is illegal because it immediately retakes the ko.

Parameters:
ko - The stone which is an illegal move without making a ko threat. This parameter may be null if there is no ko.

setIllegalMoves

protected void setIllegalMoves(Stone[] moves)
This method sets the moves that are illegal, excluding the ko.

Parameters:
moves - An array of Stone objects which are illegal moves.

isSelfInitializingUser

public boolean isSelfInitializingUser()
Description copied from class: Player
Return whether the player initializes itself on startup. All players will set their own handicaps. If false, then when a saved game is reloaded, this player requires that the existing game be set explicitly, through multiple calls to makeMove().

Overrides:
isSelfInitializingUser in class NonvalidatedPlayer
Returns:
true if self initializing, or false.

getIdentifyingInfo

public String getIdentifyingInfo()
Description copied from class: Player
Return a String which identifies the player.

Specified by:
getIdentifyingInfo in class Player
Returns:
A String object such as "MoyomanPlayer".