|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.module.Module | +--org.moyoman.module.endgame.simpleendgame.SimpleEndgame
This module implements the Endgame interface. It is responsible for finding sequences of moves at the end of the game.
Field Summary | |
private static DebugType[] |
dt
The debug types that this module supports. |
private boolean |
isGenerated
This flag is used to determine when to clear variables set by generateMove(). |
private Board |
lastBoard
The last board obtained from generateMove(). |
private MoveDescriptorForest |
mdf
The MoveDescriptorForest object containing sequences of moves. |
private ModuleType[] |
mt
The modules that this module requires. |
private RatedMove[] |
rm
The moves that were rated by this module. |
private boolean |
sequenceFlag
This flag is used to determine if a call to getSequences() is valid. |
Fields inherited from class org.moyoman.module.Module |
|
Fields inherited from interface org.moyoman.module.endgame.Endgame |
CONFIDENCE |
Constructor Summary | |
SimpleEndgame(GameId id,
ModuleName name)
Create the SimpleEndgame object. |
Method Summary | |
private void |
addRatedMove(Geometry geo,
Stone target,
short num,
float val,
HashMap rm)
Add rated moves to the HashMap if they are not in the convex hull. |
private boolean |
clearHorizontalPathToEdge(Stone st,
Board board)
Determine if the stone has a clear path to the nearest horizontal edge. |
private boolean |
clearVerticalPathToEdge(Stone st,
Board board)
Determine if there is a clear path from the stone to the vertical edge. |
Object |
clone()
Clone the module. |
private void |
evaluateMoves(Board board,
Geometry geo,
ArrayList al,
Color color,
short moveNumber,
boolean isHorizontal,
HashMap ratedMoves)
Evaluate the moves in the list, and rate them accordingly. |
private void |
generateMDF()
Generate the MoveDescriptorForest object describing sequences of moves. |
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()
Get sequences of moves that might occur in endgame play. |
private boolean |
isCloseToHorizontalEdge(Stone st,
Board board)
Determine if a stone is close to a horizontal edge. |
private boolean |
isCloseToVerticalEdge(Stone st,
Board board)
Determine if a stone is close to a vertical edge. |
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 |
Field Detail |
private static DebugType[] dt
private ModuleType[] mt
private RatedMove[] rm
private Board lastBoard
private MoveDescriptorForest mdf
private boolean isGenerated
private boolean sequenceFlag
Constructor Detail |
public SimpleEndgame(GameId id, ModuleName name) throws InternalErrorException
id
- The id of the game.name
- The name of this module.
InternalErrorException
- Thrown if the operation fails for any reason.Method Detail |
public void generateMove(Module[] modules)
generateMove
in class Module
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.private void generateMDF()
private void evaluateMoves(Board board, Geometry geo, ArrayList al, Color color, short moveNumber, boolean isHorizontal, HashMap ratedMoves)
board
- The Board module.geo
- The Geometry module.al
- Each element is a stone to be rated.color
- The color of the side to move.moveNumber
- The move number of the next move.isHorizontal
- indicates if the edge examined is a horizontal or vertical one.ratedMoves
- The rated moves are added to this HashMap as the value, the key is
the corresponding Stone object.private void addRatedMove(Geometry geo, Stone target, short num, float val, HashMap rm)
geo
- The Geometry module.target
- The position of the move.num
- The move numberval
- The rating of the move.rm
- The HashMap to add the Stone, RatedMove pair to.private boolean isCloseToHorizontalEdge(Stone st, Board board)
st
- The stone being tested.board
- The Board module.
private boolean isCloseToVerticalEdge(Stone st, Board board)
st
- The stone being tested.board
- The Board module.
private boolean clearHorizontalPathToEdge(Stone st, Board board)
st
- The stone being tested.board
- The Board module.
private boolean clearVerticalPathToEdge(Stone st, Board board)
st
- The stone being tested.board
- The Board module.
public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation
in class Module
types
- Only return a subset of the debug types in this array.
public DebugType[] getDebugTypes()
getDebugTypes
in class Module
public RatedMove[] getMoves()
getMoves
in interface ModuleInterface
getMoves
in class Module
public ModuleType[] getRequiredModuleList()
getRequiredModuleList
in class Module
public void makeMove(Move move, Module[] modules)
makeMove
in class Module
move
- The move that was just made.modules
- The modules that this method needs to perform its job.public MoveDescriptorForest getSequences() throws NoSuchDataException
getSequences
in interface Endgame
NoSuchDataException
- Thrown if the last move made was not generated by this player.public Object clone()
clone
in interface ModuleInterface
clone
in class Module
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |