|
|||||||||||
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 Board
public boolean isTerritoryScoring()
isTerritoryScoring
in interface Board
public boolean doCountPointsInSeki()
doCountPointsInSeki
in interface Board
public boolean isSuicideAllowed()
isSuicideAllowed
in interface Board
public short superKoRule()
superKoRule
in interface Board
public boolean isBentFourDeadByRule()
isBentFourDeadByRule
in interface Board
public boolean mustWhiteMoveLast()
mustWhiteMoveLast
in interface Board
public boolean freePlacementOfHandicapStones()
freePlacementOfHandicapStones
in interface Board
public short numberOfPassesToEndGame()
numberOfPassesToEndGame
in interface Board
public float getKomi()
getKomi
in interface Board
getKomi
in class Module
public Stone getLastMoveKo()
getLastMoveKo
in interface Board
public Stone[] getSuicideMoves()
getSuicideMoves
in interface Board
public Stone[] getSuperKoMoves()
getSuperKoMoves
in interface Board
public Stone[] getIllegalMoves()
getIllegalMoves
in interface Board
public NumberedStone[] getAllKos()
getAllKos
in interface Board
public NumberedStone[] getAllPrisoners()
getAllPrisoners
in interface Board
public NumberedStone[] getAllBlackPrisoners()
getAllBlackPrisoners
in interface Board
public NumberedStone[] getAllWhitePrisoners()
getAllWhitePrisoners
in interface Board
public Stone[] getLastMovePrisoners()
getLastMovePrisoners
in interface Board
public boolean isLegal(Stone st)
isLegal
in interface Board
st
- The stone object.
public short getLegalityStatus(Stone st)
getLegalityStatus
in interface Board
st
- The move being tested.
public Stone[] getLegalMoves()
getLegalMoves
in interface Board
public short getTotalBlackPrisonerCount()
getTotalBlackPrisonerCount
in interface Board
public short getTotalWhitePrisonerCount()
getTotalWhitePrisonerCount
in interface Board
public short getLastMovePrisonerCount()
getLastMovePrisonerCount
in interface Board
public Move getLastMove() throws NoSuchDataException
getLastMove
in interface Board
NoSuchDataException
- Thrown if the board is empty or only contains handicap stones.public MoveDescriptor getLastMoveDescriptor() throws NoSuchDataException
getLastMoveDescriptor
in interface Board
NoSuchDataException
- Thrown if the board is empty or only contains handicap stones.public Color getColor(Point pt)
getColor
in interface Board
pt
- The point in question.
public Stone[] getBlackStones()
getBlackStones
in interface Board
public Stone[] getWhiteStones()
getWhiteStones
in interface Board
public Stone[] getStones()
getStones
in interface Board
public short getStoneCount()
getStoneCount
in interface Board
public void generateMove(Module[] modules)
generateMove
in class Module
modules
- The modules upon which this module is dependent.public Color[][] getBoardArray()
getBoardArray
in interface Board
public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation
in class Module
types
- The debug types which are requested.
public DebugType[] getDebugTypes()
getDebugTypes
in class Module
public Move[] getAllMoves()
getAllMoves
in interface Board
public RatedMove[] getMoves()
getMoves
in interface ModuleInterface
getMoves
in class Module
public ModuleType[] getRequiredModuleList()
getRequiredModuleList
in class Module
public short getMoveNumber()
getMoveNumber
in interface Board
public void makeMove(Move move) throws IllegalMoveException, InternalErrorException
makeMove
in interface Board
move
- 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 Module
move
- 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 Board
public boolean didSuicideOccur()
didSuicideOccur
in interface Board
public String toString()
toString
in class Object
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 |