|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.helper.Helper | +--org.moyoman.helper.board.rules.RulesHelper | +--org.moyoman.helper.board.rules.agarules.AGARules | +--org.moyoman.helper.board.rules.agarules.agarulesimpl.AGARulesImpl
This class implements the AGARules interface to return the correct responses for the AGA rule set.
Field Summary | |
private static DebugType[] |
dt
The debug types that this helper returns. |
private Stone |
ko
The move which would cause an illegal retaking of the ko, or null. |
private Board |
lastBoard
A Board object which represents the current state of the game. |
private static ModuleType[] |
mt
The modules that this helper requires. |
private HashSet |
occupied
All of the Stone objects which are currently on the board. |
private HashSet |
suicide
All of the Stone objects that would cause an illegal suicide on the next move. |
private HashSet |
superKo
All of the Stone objects that would cause an illegal super ko on the next move. |
(package private) HashSet |
zobrist
Long objects which are the Zobrist hashes for each previous board position. |
Fields inherited from class org.moyoman.helper.Helper |
|
Constructor Summary | |
AGARulesImpl(GameId gid,
Mode mode,
HelperName hname,
Component parent)
Create the AGARulesImpl object. |
Method Summary | |
private void |
addGroupToSet(Stone st,
Set set,
Color[][] stones)
Add all of the stones of the same color and group as the specified stone to the set. |
private void |
assessKo(Board board)
Determine if there is a ko, and set the ko variable. |
private void |
assessSuperKo(Board board)
|
Object |
clone()
Override the Object.clone() method. |
private void |
computeLegalAndIllegalMoves(Board board)
Determine which moves are legal and illegal. |
boolean |
doCountPointsInSeki()
Determine if points in a seki are counted as territory. |
Set |
findPrisoners(Board board)
Find the set of prisoners to be removed from the board. |
boolean |
freePlacementOfHandicapStones()
Determine if handicap stones are placed in a fixed pattern. |
private Stone[] |
getAdjacentStones(Color c,
int x,
int y,
Color[][] stones)
Get the stones immediately adjacent to this stone of the same color. |
private Stone[] |
getAdjacentStones(Stone st,
Color[][] stones)
Get the stones immediately adjacent to this stone of the same color. |
Debug[] |
getDebugInformation(DebugType[] types)
Get the debug information for this helper. |
DebugType[] |
getDebugTypes()
Get the debug types that this helper returns. |
Stone |
getKo()
Return the move that would be an illegal retaking of the ko. |
float |
getKomi()
Get the komi for an even game. |
short |
getLegalityStatus(NumberedStone ns,
Board board)
Determine if the move is legal or not. |
private Set |
getPrisoners(Stone st,
Color[][] stones)
Get the prisoners which are caused by playing the specified stone. |
ModuleType[] |
getRequiredModuleList()
Get the module types that this helper requires. |
Rules |
getRules()
Get the Rules object corresponding to AGA rules. |
Stone[] |
getSuicide()
Get the stones which would be an illegal move because it would lead to suicide. |
Stone[] |
getSuperKo()
Get all the stones which would cause an illegal recreation of the whole board position. |
boolean |
isBentFourDeadByRule()
Determine if the bent four position is played out or not. |
boolean |
isLegalMove(NumberedStone ns,
Board board)
Determine if the move is a legal move. |
private boolean |
isSuicide(Stone st,
Color[][] stones)
Determine if the move would be suicide. |
boolean |
isSuicideAllowed()
Determine if suicide is allowed. |
private boolean |
isSurrounded(Stone st,
Color[][] stones)
Determine if this stone is in a group with zero liberties. |
boolean |
isTerritoryScoring()
Determine if territory or area scoring is used. |
void |
makeMove(Board board)
Update this rules helper object with the current board position. |
boolean |
mustWhiteMoveLast()
Determine if white must make the last move. |
short |
numberOfPassesToEndGame()
Determine the number of consecutive passes to end the game. |
short |
superKoRule()
Determine the rule regarding super ko. |
Methods inherited from class org.moyoman.helper.Helper |
checkTime, create, createHelper, debug, error, error, fatal, fatal, getAllHelpers, getHelper, getHelperName, getId, getMode, getModule, getParent, getScheduler, information, setTime, warning, warning |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static DebugType[] dt
private static ModuleType[] mt
private HashSet suicide
private HashSet superKo
private HashSet occupied
private Stone ko
HashSet zobrist
private Board lastBoard
Constructor Detail |
public AGARulesImpl(GameId gid, Mode mode, HelperName hname, Component parent) throws InternalErrorException
gid
- The game id.mode
- The mode of the player.hname
- The name of this helper.parent
- The RulesHelper module.
InternalErrorException
- Thrown if the operation fails for any reason.Method Detail |
public boolean doCountPointsInSeki()
doCountPointsInSeki
in class RulesHelper
public boolean freePlacementOfHandicapStones()
freePlacementOfHandicapStones
in class RulesHelper
public float getKomi()
getKomi
in class RulesHelper
public boolean isBentFourDeadByRule()
isBentFourDeadByRule
in class RulesHelper
public boolean isSuicideAllowed()
isSuicideAllowed
in class RulesHelper
public boolean isTerritoryScoring()
isTerritoryScoring
in class RulesHelper
public boolean mustWhiteMoveLast()
mustWhiteMoveLast
in class RulesHelper
public short numberOfPassesToEndGame()
numberOfPassesToEndGame
in class RulesHelper
public short superKoRule()
superKoRule
in class RulesHelper
public Stone[] getSuicide()
getSuicide
in class RulesHelper
public Stone getKo()
getKo
in class RulesHelper
public Stone[] getSuperKo()
getSuperKo
in class RulesHelper
private void assessSuperKo(Board board)
public boolean isLegalMove(NumberedStone ns, Board board)
isLegalMove
in class RulesHelper
ns
- The NumberedStone object which is the move.board
- The Board object with the current board position.
public short getLegalityStatus(NumberedStone ns, Board board)
getLegalityStatus
in class RulesHelper
board
- The Board object with the current board position.
or the reason why it is illegal.ns
- The move being tested.
public void makeMove(Board board)
makeMove
in class RulesHelper
board
- The Board object with the current board position.public Set findPrisoners(Board board)
findPrisoners
in class RulesHelper
board
- The Board object with the current board position with prisoners still present.
public Rules getRules()
getRules
in class RulesHelper
public Object clone()
clone
in class Helper
public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation
in class Helper
types
- The supported debug types.
public DebugType[] getDebugTypes()
getDebugTypes
in class Helper
public ModuleType[] getRequiredModuleList()
getRequiredModuleList
in class Helper
private void computeLegalAndIllegalMoves(Board board)
board
- The Board object which contains the current board position.private void assessKo(Board board)
board
- The current board position.private Set getPrisoners(Stone st, Color[][] stones)
st
- The stone which was played to cause the captures.
private void addGroupToSet(Stone st, Set set, Color[][] stones)
st
- The stone for which adjacent stones are being found.set
- A Set which contains the adjacent stones found so far.private boolean isSuicide(Stone st, Color[][] stones)
st
- The stone in question.
private Stone[] getAdjacentStones(Color c, int x, int y, Color[][] stones)
c
- The color of stone looked for.x
- The horizontal coordinate checked.y
- The vertical coordinate checked.
private Stone[] getAdjacentStones(Stone st, Color[][] stones)
st
- The stone in question.
private boolean isSurrounded(Stone st, Color[][] stones)
st
- The stone in question.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |