org.moyoman.module.proverbs.igoproverbs
Class IgoProverbs

java.lang.Object
  |
  +--org.moyoman.module.Module
        |
        +--org.moyoman.module.proverbs.igoproverbs.IgoProverbs
All Implemented Interfaces:
Cloneable, Component, ModuleInterface, Proverbs, Serializable

public class IgoProverbs
extends Module
implements Proverbs

This module implements the Proverbs interface. It is responsible for generating moves from the proverbs of GO.

Author:
MingHuang Cheng
See Also:
Serialized Form

Field Summary
private static DebugType[] dt
          The debug types that this module supports.
private  GoProverbs igo
          an Igo class to find moves from the proverbs of GO.
private  boolean isGenerated
          This flag is used to determine when to clear variables set by generateMove().
private  Board lastBoard
          The current Board module.
private  MoveDescriptorForest mdf
          The sequences of moves recommended by proverbs.
private  ModuleType[] mt
          The modules that this module requires.
private  RatedMove[] rm
          The moves that were rated by this module.
 
Fields inherited from class org.moyoman.module.Module
 
Fields inherited from interface org.moyoman.module.proverbs.Proverbs
CONFIDENCE
 
Constructor Summary
IgoProverbs(GameId id, ModuleName name)
          Create the IgoProverbs object.
 
Method Summary
private  boolean addRated(Board board, VecInt vec)
          Return true if has moves to add.
private  boolean addRated(Board board, VecInt vec, float conf)
          Return true if has moves to add.
 boolean capAnsKei(Board board)
          Get rated moves from the proverb [Answer the capping play with a knight's move].
 boolean centerOf3(Board board)
          Get rated moves from the proverb [Play at the centre of three stones].
 Object clone()
          Clone the module.
 boolean extCross(Board board)
          Get rated moves from the proverb [Crosscut then extend].
 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 are suggested or discouraged by a proverb.
private  boolean haneEnd2(Board board)
          Get rated moves from the proverb [hane at the end of two stones].
 boolean haneResAttach(Board board)
          Get rated moves from the proverb [respond to attachment with hane].
 boolean keiAnsKosu(Board board)
          Get rated moves from the proverb [Answer keima with kosumi].
 boolean keiTuki(Board board)
          Get rated moves from the proverb [Cutting right through a knight's move is very big].
 void makeMove(Move move, Module[] modules)
          Update the internal data structures of this module with the new move.
 boolean resKata(Board board)
          Get rated moves from the proverb [never ignore a shoulder hit].
private  void setData(Board board)
          Set the data of the board to Igo.
 
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
 

Field Detail

dt

private static DebugType[] dt
The debug types that this module supports.


mt

private ModuleType[] mt
The modules that this module requires.


rm

private RatedMove[] rm
The moves that were rated by this module.


isGenerated

private boolean isGenerated
This flag is used to determine when to clear variables set by generateMove().


mdf

private MoveDescriptorForest mdf
The sequences of moves recommended by proverbs.


lastBoard

private Board lastBoard
The current Board module.


igo

private GoProverbs igo
an Igo class to find moves from the proverbs of GO.

Constructor Detail

IgoProverbs

public IgoProverbs(GameId id,
                   ModuleName name)
            throws InternalErrorException
Create the IgoProverbs object.

Parameters:
id - The id of the game.
name - The name of this module.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.
Method Detail

generateMove

public void generateMove(Module[] modules)
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.

getDebugInformation

public Debug[] getDebugInformation(DebugType[] types)
Return the debug information for this module.

Specified by:
getDebugInformation in class Module
Parameters:
types - Only return a subset of the debug types in this array.
Returns:
The debug information that this module supports.

getDebugTypes

public DebugType[] getDebugTypes()
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()
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()
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)
Update the internal data structures of this module with the new move. This module is stateless, so minimal work is done here.

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.

clone

public Object clone()
Clone the module.

Specified by:
clone in interface ModuleInterface
Overrides:
clone in class Module
Returns:
A IgoProverbs object which is a clone of this one.

getSequences

public MoveDescriptorForest getSequences()
Return sequences of moves that are suggested or discouraged by a proverb.

Specified by:
getSequences in interface Proverbs
Returns:
A MoveDescriptorForest which contains sequences of moves following proverbs.

setData

private void setData(Board board)
Set the data of the board to Igo.

Parameters:
board - The Board module.

addRated

private boolean addRated(Board board,
                         VecInt vec)
Return true if has moves to add.

Parameters:
vec - Vector to store moves.

addRated

private boolean addRated(Board board,
                         VecInt vec,
                         float conf)
Return true if has moves to add.

Parameters:
vec - Vector to store moves.
conf - The confidence in the rating, which varies between 0.0 and 1.0.

haneEnd2

private boolean haneEnd2(Board board)
Get rated moves from the proverb [hane at the end of two stones].

Parameters:
board - The Board module.
Returns:
true if find moves.

haneResAttach

public boolean haneResAttach(Board board)
Get rated moves from the proverb [respond to attachment with hane].

Parameters:
board - The Board module.
Returns:
true if find moves.

resKata

public boolean resKata(Board board)
Get rated moves from the proverb [never ignore a shoulder hit].

Parameters:
board - The Board module.
Returns:
true if find moves.

keiTuki

public boolean keiTuki(Board board)
Get rated moves from the proverb [Cutting right through a knight's move is very big].

Parameters:
board - The Board module.
Returns:
true if find moves.

extCross

public boolean extCross(Board board)
Get rated moves from the proverb [Crosscut then extend].

Parameters:
board - The Board module.
Returns:
true if find moves.

capAnsKei

public boolean capAnsKei(Board board)
Get rated moves from the proverb [Answer the capping play with a knight's move].

Parameters:
board - The Board module.
Returns:
true if find moves.

centerOf3

public boolean centerOf3(Board board)
Get rated moves from the proverb [Play at the centre of three stones].

Parameters:
board - The Board module.
Returns:
true if find moves.

keiAnsKosu

public boolean keiAnsKosu(Board board)
Get rated moves from the proverb [Answer keima with kosumi].

Parameters:
board - The Board module.
Returns:
true if find moves.