org.moyoman.module.joseki.josekiimpl
Class JosekiImpl

java.lang.Object
  |
  +--org.moyoman.module.Module
        |
        +--org.moyoman.module.joseki.josekiimpl.JosekiImpl
All Implemented Interfaces:
Cloneable, Component, Joseki, ModuleInterface, Serializable

public class JosekiImpl
extends Module
implements Joseki

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.moyoman.module.Module
 
Fields inherited from interface org.moyoman.module.joseki.Joseki
CONFIDENCE
 
Constructor Summary
JosekiImpl(GameId id, ModuleName name)
          Create a JosekiImpl object.
 
Method Summary
 Object clone()
          Clone the module.
 float evaluateMove(Stone next)
          Evaluate the parameter as a possible move.
 void generateMove(Module[] modules)
          Generate the move for this module.
 Debug[] getDebugInformation(DebugType[] types)
          Return the debug information for this module.
 DebugType[] getDebugTypes()
          Return the types of debug information that this module supports.
 RatedMove[] getMoves()
          Return the moves generated by the module.
 ModuleType[] getRequiredModuleList()
          Return the modules that this module requires to perform its task.
 MoveDescriptorForest getSequences()
          Return sequences of moves that match positions on the board.
 void makeMove(Move move, Module[] modules)
          Update the internal data structures of this module with the new move.
 
Methods inherited from class org.moyoman.module.Module
checkTime, create, createHelper, debug, error, error, fatal, fatal, getAllHelpers, getHelper, getId, getKomi, getModule, getModuleName, getScheduler, information, setTime, warning, warning
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.moyoman.module.ModuleInterface
getScheduler
 

Constructor Detail

JosekiImpl

public JosekiImpl(GameId id,
                  ModuleName name)
           throws InternalErrorException
Create a JosekiImpl object.

Parameters:
id - The id of the game.
name - The name of the module.
Throws:
InternalErrorException - Thrown if anything goes wrong.
Method Detail

clone

public Object clone()
Description copied from interface: ModuleInterface
Clone the module. This method overrides the one in Object. Cloning modules is an important requirement for the system to function correctly. The derived class of Module must override this method. It may be as straightforward as calling super.clone(). Consult any Java textbook for more details. If you are not sure, ask for help.

Specified by:
clone in interface ModuleInterface
Overrides:
clone in class Module
Returns:
The cloned Module object.

generateMove

public void generateMove(Module[] modules)
                  throws InternalErrorException
Description copied from class: Module
Generate the move for this module. The side effect of calling this method is that an array of RatedMove objects is stored which is returned by the getMoves() method.

Specified by:
generateMove in class Module
Parameters:
modules - An array of modules which this module needs in order to perform its work. Those modules reflect the current state of the board but are copies of the actual modules, so this method is free to manipulate them.
InternalErrorException

getDebugInformation

public Debug[] getDebugInformation(DebugType[] types)
Description copied from class: Module
Return the debug information for this module.

Specified by:
getDebugInformation in class Module
Parameters:
types - The debug types that the caller knows how to handle.
Returns:
The debug information that this module supports.

getDebugTypes

public DebugType[] getDebugTypes()
Description copied from class: Module
Return the types of debug information that this module supports.

Specified by:
getDebugTypes in class Module
Returns:
The types of debug information that this module supports.

getMoves

public RatedMove[] getMoves()
Description copied from interface: ModuleInterface
Return the moves generated by the module. Note that both good and bad moves can be returned.

Specified by:
getMoves in interface ModuleInterface
Specified by:
getMoves in class Module
Returns:
An array of RatedMove objects.

getRequiredModuleList

public ModuleType[] getRequiredModuleList()
Description copied from class: Module
Return the modules that this module requires to perform its task.

Specified by:
getRequiredModuleList in class Module
Returns:
An array of module types that the module requires.

makeMove

public void makeMove(Move move,
                     Module[] modules)
              throws IllegalMoveException,
                     InternalErrorException
Description copied from class: Module
Update the internal data structures of this module with the new move. Note that this method is called both when the client makes a move, and when the server makes a move. If the module is stateless, then this method will only do minimal work. See org.moyoman.module.random.randomimpl.RandomImpl for an example of this.

Specified by:
makeMove in class Module
Parameters:
move - The move that was just made.
modules - The modules that this method needs to perform its job.
IllegalMoveException
InternalErrorException

getSequences

public MoveDescriptorForest getSequences()
Description copied from interface: Joseki
Return sequences of moves that match positions on the board. Sequences for all four corners are returned. No attempt is made to match the correct joseki to the whole board situation. That is the responsibility of the fuseki module. This method only returns good moves.

Specified by:
getSequences in interface Joseki
Returns:
a MoveDescriptorForest object which contains possible sequences.

evaluateMove

public float evaluateMove(Stone next)
Description copied from interface: Joseki
Evaluate the parameter as a possible move.

Specified by:
evaluateMove in interface Joseki
Parameters:
next - The potential next move.
Returns:
A float, where 1.0 is a good move, and -1.0 is a bad move.