org.moyoman.framework
Class ValidateController

java.lang.Object
  |
  +--org.moyoman.framework.Controller
        |
        +--org.moyoman.framework.ValidateController
All Implemented Interfaces:
Serializable

public class ValidateController
extends Controller

This class is used to validate moves for players which do not do so themselves.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.moyoman.framework.Controller
gr, id, persister, scheduler
 
Constructor Summary
private ValidateController(Color color, Handicap handicap, Mode mode)
          Create a new ValidateController object.
private ValidateController(Color color, Handicap handicap, Mode mode, Rules rules, float komi)
          Create a new ValidateController object.
 
Method Summary
static ValidateController newGame(Color color, Handicap handicap, Mode mode)
          Start a new game with the specified parameters.
static ValidateController newGame(Color color, Handicap handicap, Mode mode, Rules rules, float komi)
          Start a new game with the specified parameters.
private  MoveDescriptor validateMove(Move move)
          Verify that this move is a legal one.
 MoveDescriptor validateMove(Stone stone)
          Verify that this move is a legal one.
 
Methods inherited from class org.moyoman.framework.Controller
deleteGame, endGame, gameExists, getColor, getController, getGameRecord, getHandicap, getId, getKomi, getLastMoveKo, getMode, getMode, getMoveNumber, getPersister, getProperties, getRules, getRules, getSuicideMoves, getSuperKoMoves, listActiveGames, listSavedGames, loadGame, makeMove, onExit, pass, resignGame, resumeActiveGame, resumeActiveGame, saveGame, setProperties, takeBackMove, writeLastGameInformation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidateController

private ValidateController(Color color,
                           Handicap handicap,
                           Mode mode,
                           Rules rules,
                           float komi)
                    throws InternalErrorException
Create a new ValidateController object.

Parameters:
color - The color of the player using the server to play this game.
handicap - The handicap of this game.
mode - The mode used by the player using the server to play this game.
rules - The rules for this game.
komi - The komi for this game.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

ValidateController

private ValidateController(Color color,
                           Handicap handicap,
                           Mode mode)
                    throws InternalErrorException
Create a new ValidateController object.

Parameters:
color - The color of the player using the server to play this game.
handicap - The handicap of this game.
mode - The mode used by the player using the server to play this game.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.
Method Detail

validateMove

public MoveDescriptor validateMove(Stone stone)
                            throws IllegalMoveException,
                                   InternalErrorException
Verify that this move is a legal one.

Parameters:
stone - The move that was made.
Returns:
A MoveDescriptor object indicating prisoners, ko, etc.
Throws:
IllegalMoveException - Thrown if the move to be made is not legal.
InternalErrorException - Thrown if the operation fails for any reason.

validateMove

private MoveDescriptor validateMove(Move move)
                             throws IllegalMoveException,
                                    InternalErrorException
Verify that this move is a legal one.

Parameters:
move - The move to be verified.
Returns:
A MoveDescriptor object indicating prisoners, ko, etc.
Throws:
IllegalMoveException - Thrown if the move to be made is not legal.
InternalErrorException - Thrown if the operation fails for any reason.

newGame

public static ValidateController newGame(Color color,
                                         Handicap handicap,
                                         Mode mode,
                                         Rules rules,
                                         float komi)
                                  throws InternalErrorException
Start a new game with the specified parameters.

Parameters:
color - The color of the client
handicap - The handicap to be used.
mode - The mode of play.
rules - The rule set, e.g, Japanese
komi - The komi to be used. A positive value is added to whites score, a negative value subtracted from it.
Returns:
The ValidateController object that is created.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

newGame

public static ValidateController newGame(Color color,
                                         Handicap handicap,
                                         Mode mode)
                                  throws InternalErrorException
Start a new game with the specified parameters.

Parameters:
color - The color of the client
handicap - The handicap to be used.
mode - The mode of play.
Returns:
The ValidateController object that is created.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.