org.moyoman.framework
Class GenerateController

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

public class GenerateController
extends Controller

This is the Controller class that controls the generation of moves by the server and the associated operations.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.moyoman.framework.Controller
gr, id, persister, scheduler
 
Constructor Summary
GenerateController(Color color, Handicap handicap, Mode mode)
           
GenerateController(Color color, Handicap handicap, Mode mode, Rules rules, float komi)
           
 
Method Summary
 MoveDescriptor generateMove()
          Get the servers move in the specified game.
 Debug[] getDebuggingInfo(ModuleName modulename, DebugType[] types)
          Get the debugging information for the specified module.
 MoveDescriptor getSuggestedMove()
          Suggest a move for the client.
 ModuleName[] listDebuggingModules(DebugType[] types)
          Get a list of all of the modules for which debugging information is available.
static GenerateController newGame(Color color, Handicap handicap, Mode mode)
          Start a new game with the specified parameters.
static GenerateController newGame(Color color, Handicap handicap, Mode mode, Rules rules, float komi)
          Start a new game with the specified parameters.
 BooleanResponse requestResignation()
          The client is requesting that the server resign the specified game.
 void resignGame()
          The client is resigning the specified game.
 
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, 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

GenerateController

public GenerateController(Color color,
                          Handicap handicap,
                          Mode mode)
                   throws InternalErrorException

GenerateController

public GenerateController(Color color,
                          Handicap handicap,
                          Mode mode,
                          Rules rules,
                          float komi)
                   throws InternalErrorException
Method Detail

generateMove

public MoveDescriptor generateMove()
                            throws InternalErrorException
Get the servers move in the specified game.

Returns:
The server generated move.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

getDebuggingInfo

public Debug[] getDebuggingInfo(ModuleName modulename,
                                DebugType[] types)
                         throws InternalErrorException
Get the debugging information for the specified module.

Parameters:
modulename - The module for which the information is returned.
Returns:
The debugging information requested.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

getSuggestedMove

public MoveDescriptor getSuggestedMove()
                                throws InternalErrorException
Suggest a move for the client.

Returns:
The suggested move.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

listDebuggingModules

public ModuleName[] listDebuggingModules(DebugType[] types)
                                  throws InternalErrorException
Get a list of all of the modules for which debugging information is available. There are a number of different types of debugging information, and the client may not support displaying them all, so the types parameter is used to specify which debugging types are supported. The module name is only returned if it implements at least one of the supported debugging types.

Parameters:
types - An array of debugging types that the client understands.
Returns:
The modules with debugging information of the supported types.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

newGame

public static GenerateController 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 GenerateController object that is created.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

newGame

public static GenerateController 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 GenerateController object that is created.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

requestResignation

public BooleanResponse requestResignation()
                                   throws InternalErrorException
The client is requesting that the server resign the specified game.

Returns:
A response to the clients request.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

resignGame

public void resignGame()
                throws InternalErrorException
The client is resigning the specified game. The game is removed from the list of active games. It is saved to or deleted from permanent storage.

Overrides:
resignGame in class Controller
Throws:
InternalErrorException - Thrown if the operation fails for any reason.