|
|||||||||||
| 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.board.boardimpl.BoardImpl
This module implements the Board interface. It is responsible for maintaining information about the state of the board, and things such as legal moves, prisoners, etc.
| Field Summary | |
private ArrayList |
allPrisoners
Store information about all prisoners during the game. |
private boolean |
isGenerated
This indicates if makeMove() was called immediately after generateMove(). |
private ArrayList |
kos
Store information about all kos during the game. |
private Color |
moveColor
The color to move next. |
private short |
moveNumber
The move number for the next turn. |
private ArrayList |
moves
Store all of the moves for the game, including handicap stones. |
private static ModuleType[] |
mt
The modules that this module is dependent on. |
private ArrayList |
prisoners
Store information about prisoners on the last move. |
private ArrayList |
ratedMoves
Give the illegal moves a large negative rating. |
private RulesHelper |
rhelper
The RulesHelper object that determines the legality of moves. |
private Color[][] |
stones
Each element of the array represents the color of that point on the board. |
| Fields inherited from class org.moyoman.module.Module |
|
| Fields inherited from interface org.moyoman.module.board.Board |
ALLOWED, DRAW, FILLED, FORBIDDEN, KO, LEGAL, SUICIDE, SUPERKO, WRONG_COLOR |
| Constructor Summary | |
BoardImpl(GameId id,
ModuleName name)
Create a new BoardImpl object. |
|
| Method Summary | |
Object |
clone()
Override the Object.clone() method. |
boolean |
didSuicideOccur()
Return true if the last move was a suicide, or false. |
boolean |
doCountPointsInSeki()
Determine if the territory in a seki is counted. |
boolean |
freePlacementOfHandicapStones()
Determine if handicap stones must be placed in arbitrary positions. |
void |
generateMove(Module[] modules)
Rate different moves that could be made by the current player. |
NumberedStone[] |
getAllBlackPrisoners()
Return all of the black prisoners which have occurred during the game. |
NumberedStone[] |
getAllKos()
Return all of the kos which have occurred during the game. |
Move[] |
getAllMoves()
Get all moves which have been made in this game. |
NumberedStone[] |
getAllPrisoners()
Return all of the prisoners which have occurred during the game. |
NumberedStone[] |
getAllWhitePrisoners()
Return all of the white prisoners which have occurred during the game. |
Stone[] |
getBlackStones()
Get all of the black stones on the board. |
Color[][] |
getBoardArray()
Get a two dimensional array of Color objects representing the current board position. |
Color |
getColor(Point pt)
Get the color for a given point on the board. |
Color |
getColorToMove()
Get the color of the player to move next. |
Debug[] |
getDebugInformation(DebugType[] types)
Get the debug information for this module. |
DebugType[] |
getDebugTypes()
Get the debug types which this module supports. |
Stone[] |
getIllegalMoves()
Return all moves which would be illegal for whatever reason. |
float |
getKomi()
Return the komi for this game. |
Move |
getLastMove()
Get the last move. |
MoveDescriptor |
getLastMoveDescriptor()
Get a MoveDescriptor describing the last move. |
Stone |
getLastMoveKo()
Return the move which would illegaly retake the ko. |
short |
getLastMovePrisonerCount()
Return the number of prisoners captured on the last move. |
Stone[] |
getLastMovePrisoners()
Return the prisoners which were captured on the last move. |
short |
getLegalityStatus(Stone st)
Determine the legality of the given move. |
Stone[] |
getLegalMoves()
Get all of the legal moves. |
short |
getMoveNumber()
Get the move number. |
RatedMove[] |
getMoves()
Get the moves rated by this module. |
ModuleType[] |
getRequiredModuleList()
Get the modules that this module uses. |
short |
getStoneCount()
Get the total number of stones on the board. |
Stone[] |
getStones()
Get all of the stones on the board. |
Stone[] |
getSuicideMoves()
Return all moves which are illegal because of suicide. |
Stone[] |
getSuperKoMoves()
Return all moves which are illegal because they recreate a previous board position. |
short |
getTotalBlackPrisonerCount()
Return the total number of black prisoners captured. |
short |
getTotalWhitePrisonerCount()
Return the total number of white prisoners captured. |
Stone[] |
getWhiteStones()
Get all of the white stones on the board. |
boolean |
isBentFourDeadByRule()
Determine if a bent four in the corner is automatically dead. |
boolean |
isEndOfGame()
Determine if the last move ended the game. |
boolean |
isLegal(Stone st)
Determine if the given move is legal. |
boolean |
isSuicideAllowed()
Determine if suicide is legal. |
boolean |
isTerritoryScoring()
Determine if the scoring method is by territory. |
void |
makeMove(Move move)
Update this module with the move which has been made. |
void |
makeMove(Move move,
Module[] modules)
Update this module with the move which has been made. |
boolean |
mustWhiteMoveLast()
Determine if white must move last. |
short |
numberOfPassesToEndGame()
Determine the number of consecutive passes to end the game. |
short |
superKoRule()
Determine the legality of a super ko. |
String |
toString()
Return a String representation of the board. |
private void |
updateState(Move move)
Update the state variables as a result of the move. |
| Methods inherited from class org.moyoman.module.Module |
checkTime, create, createHelper, debug, error, error, fatal, fatal, getAllHelpers, getHelper, getId, getModule, getModuleName, getScheduler, information, setTime, warning, warning |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.moyoman.module.ModuleInterface |
getScheduler |
| Field Detail |
private static ModuleType[] mt
private ArrayList kos
private ArrayList allPrisoners
private ArrayList prisoners
private ArrayList ratedMoves
private ArrayList moves
private RulesHelper rhelper
private Color[][] stones
private short moveNumber
private Color moveColor
private boolean isGenerated
| Constructor Detail |
public BoardImpl(GameId id,
ModuleName name)
throws InternalErrorException
id - The id of the game.name - The ModuleName object corresponding to this module.
InternalErrorException - Thrown if the operation fails for any reason.| Method Detail |
public Color getColorToMove()
getColorToMove in interface Boardpublic boolean isTerritoryScoring()
isTerritoryScoring in interface Boardpublic boolean doCountPointsInSeki()
doCountPointsInSeki in interface Boardpublic boolean isSuicideAllowed()
isSuicideAllowed in interface Boardpublic short superKoRule()
superKoRule in interface Boardpublic boolean isBentFourDeadByRule()
isBentFourDeadByRule in interface Boardpublic boolean mustWhiteMoveLast()
mustWhiteMoveLast in interface Boardpublic boolean freePlacementOfHandicapStones()
freePlacementOfHandicapStones in interface Boardpublic short numberOfPassesToEndGame()
numberOfPassesToEndGame in interface Boardpublic float getKomi()
getKomi in interface BoardgetKomi in class Modulepublic Stone getLastMoveKo()
getLastMoveKo in interface Boardpublic Stone[] getSuicideMoves()
getSuicideMoves in interface Boardpublic Stone[] getSuperKoMoves()
getSuperKoMoves in interface Boardpublic Stone[] getIllegalMoves()
getIllegalMoves in interface Boardpublic NumberedStone[] getAllKos()
getAllKos in interface Boardpublic NumberedStone[] getAllPrisoners()
getAllPrisoners in interface Boardpublic NumberedStone[] getAllBlackPrisoners()
getAllBlackPrisoners in interface Boardpublic NumberedStone[] getAllWhitePrisoners()
getAllWhitePrisoners in interface Boardpublic Stone[] getLastMovePrisoners()
getLastMovePrisoners in interface Boardpublic boolean isLegal(Stone st)
isLegal in interface Boardst - The stone object.
public short getLegalityStatus(Stone st)
getLegalityStatus in interface Boardst - The move being tested.
public Stone[] getLegalMoves()
getLegalMoves in interface Boardpublic short getTotalBlackPrisonerCount()
getTotalBlackPrisonerCount in interface Boardpublic short getTotalWhitePrisonerCount()
getTotalWhitePrisonerCount in interface Boardpublic short getLastMovePrisonerCount()
getLastMovePrisonerCount in interface Board
public Move getLastMove()
throws NoSuchDataException
getLastMove in interface BoardNoSuchDataException - Thrown if the board is empty or only contains handicap stones.
public MoveDescriptor getLastMoveDescriptor()
throws NoSuchDataException
getLastMoveDescriptor in interface BoardNoSuchDataException - Thrown if the board is empty or only contains handicap stones.public Color getColor(Point pt)
getColor in interface Boardpt - The point in question.
public Stone[] getBlackStones()
getBlackStones in interface Boardpublic Stone[] getWhiteStones()
getWhiteStones in interface Boardpublic Stone[] getStones()
getStones in interface Boardpublic short getStoneCount()
getStoneCount in interface Boardpublic void generateMove(Module[] modules)
generateMove in class Modulemodules - The modules upon which this module is dependent.public Color[][] getBoardArray()
getBoardArray in interface Boardpublic Debug[] getDebugInformation(DebugType[] types)
getDebugInformation in class Moduletypes - The debug types which are requested.
public DebugType[] getDebugTypes()
getDebugTypes in class Modulepublic Move[] getAllMoves()
getAllMoves in interface Boardpublic RatedMove[] getMoves()
getMoves in interface ModuleInterfacegetMoves in class Modulepublic ModuleType[] getRequiredModuleList()
getRequiredModuleList in class Modulepublic short getMoveNumber()
getMoveNumber in interface Board
public void makeMove(Move move)
throws IllegalMoveException,
InternalErrorException
makeMove in interface Boardmove - The move to be made.
IllegalMoveException - Thrown if the move is illegal.
InternalErrorException - Thrown is the operation fails for any reason.
public void makeMove(Move move,
Module[] modules)
throws IllegalMoveException,
InternalErrorException
makeMove in class Modulemove - The move to be made.modules - The modules which this module requires.
IllegalMoveException - Thrown if the move is illegal.
InternalErrorException - Thrown is the operation fails for any reason.private void updateState(Move move)
move - The move which has been made.public boolean isEndOfGame()
isEndOfGame in interface Boardpublic boolean didSuicideOccur()
didSuicideOccur in interface Boardpublic String toString()
toString in class Objectpublic Object clone()
clone in interface ModuleInterfaceclone in class Module
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||