|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.game.AbstractAdjudicator
org.vizzini.game.boardgame.chess.ChessAdjudicator
public class ChessAdjudicator
Provides an adjudicator for 3D chess. An adjudicator instance encapsulates the rules of a game by determining the legality of actions and when the game is over.
Field Summary |
---|
Fields inherited from class org.vizzini.game.AbstractAdjudicator |
---|
_winner |
Constructor Summary | |
---|---|
ChessAdjudicator()
|
Method Summary | |
---|---|
boolean |
agentHasLine(IEnvironment environment,
IAgent agent0,
IAgent agent1,
int startF,
int startR,
int startL,
int df,
int dr,
int dl)
Return true if an agent has tokens in the line specified by the other arguments. |
void |
configure(Properties properties)
Configure this adjudicator. |
int |
getPawnPromotionLevel(IChessEnvironment board,
boolean isWhite)
Return the level for pawn promotion. |
int |
getPawnPromotionLevelsCount()
|
int |
getPawnPromotionRank(IChessEnvironment board,
boolean isWhite)
Return the rank for pawn promotion. |
Set |
getWinningPositions()
|
boolean |
isActionLegal(IEnvironment environment,
IAction action)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isActionLegal0(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isCaptureActionLegal0(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isCastleActionLegal(IChessEnvironment board,
CastleAction action)
Return true if the given castle agent action is legal in the given environment. |
boolean |
isCastleActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition kingFromPosition,
IntegerPosition kingToPosition,
IntegerPosition rookFromPosition,
IntegerPosition rookToPosition)
Return true if the given castle agent action is legal in the given environment. |
protected boolean |
isEnPassantCaptureActionLegal(IChessEnvironment board,
EnPassantCaptureAction action)
Return true if the given agent action is legal in the given environment. |
boolean |
isEnPassantCaptureActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition capturePosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isEnPassantPositions(IChessEnvironment board,
IntegerPosition fromPosition,
IntegerPosition capturePosition)
Return true if the given positions are correct for en passant capture. |
boolean |
isGameOver(IEnvironment environment)
Return true if one of the agents has won. |
boolean |
isGoal(IEnvironment environment)
Return true if one of the agents has won. |
boolean |
isInCheck(IChessEnvironment board,
IChessAgent agent)
Return true if the given agent's King is in check. |
boolean |
isInCheckmate(IChessEnvironment board,
IChessAgent agent)
Return true if the given agent's King is in checkmate. |
boolean |
isInPawnPromotionRange(IChessEnvironment board,
IntegerPosition toPosition,
boolean isWhite)
Return true if the given position is in pawn promotion range for the given board and team. |
boolean |
isMoveActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isMoveActionLegal(IChessEnvironment board,
MoveAction action)
Return true if the given agent action is legal in the given environment. |
boolean |
isMoveCaptureActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isMoveCaptureActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition,
boolean isCheckTested)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isMoveCaptureActionLegal(IChessEnvironment board,
MoveCaptureAction action)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isNonCaptureActionLegal0(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isPathClear(IChessEnvironment board,
IntegerPosition from,
IntegerPosition to)
Return true if the linear path is clear between the given positions. |
boolean |
isPawnPromotionActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isPawnPromotionActionLegal(IChessEnvironment board,
PawnPromotionAction action)
Return true if the given agent action is legal in the given environment. |
boolean |
isPawnPromotionCaptureActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isPawnPromotionCaptureActionLegal(IChessEnvironment board,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition,
boolean isCheckTested)
Return true if the given agent action is legal in the given environment. |
protected boolean |
isPawnPromotionCaptureActionLegal(IChessEnvironment board,
PawnPromotionCaptureAction action)
Return true if the given agent action is legal in the given environment. |
protected void |
kingCheck(IChessEnvironment board,
IChessAgent agent)
Make sure the King exists. |
protected void |
kingsCheck(IChessEnvironment board)
Make sure the Kings exist. |
protected boolean |
performCheckTest(IChessEnvironment board,
IAction action)
Perform a test to see if the given action will result in the action's agent being in check. |
protected void |
setPawnPromotionLevelsCount(int pawnPromotionLevelsCount)
|
Methods inherited from class org.vizzini.game.AbstractAdjudicator |
---|
areActionsLegal, getWinner, reset, setWinner |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.vizzini.game.IAdjudicator |
---|
areActionsLegal, getWinner, reset, setWinner |
Constructor Detail |
---|
public ChessAdjudicator()
Method Detail |
---|
public boolean agentHasLine(IEnvironment environment, IAgent agent0, IAgent agent1, int startF, int startR, int startL, int df, int dr, int dl)
agentHasLine
in interface IGridBoardAdjudicator
environment
- Environment of interest.agent0
- First agent.agent1
- Second agent.startF
- Starting file.startR
- Starting rank.startL
- Starting level.df
- Delta in the file direction.dr
- Delta in the rank direction.dl
- Delta in the level direction.public void configure(Properties properties) throws InstantiationException, IllegalAccessException
properties
- Source of configuration information.
InstantiationException
IllegalAccessException
public int getPawnPromotionLevel(IChessEnvironment board, boolean isWhite)
getPawnPromotionLevel
in interface IChessAdjudicator
board
- Chess board.isWhite
- Flag indicating if the token is white.public int getPawnPromotionLevelsCount()
public int getPawnPromotionRank(IChessEnvironment board, boolean isWhite)
getPawnPromotionRank
in interface IChessAdjudicator
board
- Chess board.isWhite
- Flag indicating if the token is white.public Set getWinningPositions()
getWinningPositions
in interface IGridBoardAdjudicator
public boolean isActionLegal(IEnvironment environment, IAction action)
isActionLegal
in interface IAdjudicator
environment
- Chess environment.action
- The agent action in question.
public boolean isCastleActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition kingFromPosition, IntegerPosition kingToPosition, IntegerPosition rookFromPosition, IntegerPosition rookToPosition)
isCastleActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.kingFromPosition
- King from position.kingToPosition
- King to position.rookFromPosition
- Rook from position.rookToPosition
- Rook to position.
public boolean isEnPassantCaptureActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition capturePosition, IntegerPosition toPosition)
isEnPassantCaptureActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.capturePosition
- Capture position.toPosition
- To position.
public boolean isGameOver(IEnvironment environment)
isGameOver
in interface IAdjudicator
environment
- The environment of interest.public boolean isGoal(IEnvironment environment)
isGoal
in interface IAdjudicator
environment
- The environment of interest.public boolean isInCheck(IChessEnvironment board, IChessAgent agent)
isInCheck
in interface IChessAdjudicator
board
- Chess environment.agent
- The agent whose King is in question.public boolean isInCheckmate(IChessEnvironment board, IChessAgent agent)
isInCheckmate
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.public boolean isInPawnPromotionRange(IChessEnvironment board, IntegerPosition toPosition, boolean isWhite)
isInPawnPromotionRange
in interface IChessAdjudicator
board
- Chess board.toPosition
- To position.isWhite
- Flag indicating if the token is white.public boolean isMoveActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
isMoveActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
public boolean isMoveCaptureActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
isMoveCaptureActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
public boolean isPawnPromotionActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
isPawnPromotionActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
public boolean isPawnPromotionCaptureActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
isPawnPromotionCaptureActionLegal
in interface IChessAdjudicator
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
protected boolean isActionLegal0(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
protected boolean isCaptureActionLegal0(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
protected boolean isCastleActionLegal(IChessEnvironment board, CastleAction action)
board
- Chess environment.action
- The castle agent action in question.
protected boolean isEnPassantCaptureActionLegal(IChessEnvironment board, EnPassantCaptureAction action)
board
- Chess environment.action
- The agent action in question.
protected boolean isEnPassantPositions(IChessEnvironment board, IntegerPosition fromPosition, IntegerPosition capturePosition)
protected boolean isMoveActionLegal(IChessEnvironment board, MoveAction action)
board
- Chess environment.action
- The agent action in question.
protected boolean isMoveCaptureActionLegal(IChessEnvironment board, MoveCaptureAction action)
board
- Chess environment.action
- The agent action in question.
protected boolean isMoveCaptureActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition, boolean isCheckTested)
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
protected boolean isNonCaptureActionLegal0(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.
protected boolean isPathClear(IChessEnvironment board, IntegerPosition from, IntegerPosition to)
protected boolean isPawnPromotionActionLegal(IChessEnvironment board, PawnPromotionAction action)
board
- Chess environment.action
- The agent action in question.
protected boolean isPawnPromotionCaptureActionLegal(IChessEnvironment board, PawnPromotionCaptureAction action)
board
- Chess environment.action
- The agent action in question.
protected boolean isPawnPromotionCaptureActionLegal(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition, boolean isCheckTested)
board
- Chess environment.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.protected void kingCheck(IChessEnvironment board, IChessAgent agent)
board
- Chess environment.agent
- Chess agent.protected void kingsCheck(IChessEnvironment board)
board
- Chess environment.protected boolean performCheckTest(IChessEnvironment board, IAction action)
protected void setPawnPromotionLevelsCount(int pawnPromotionLevelsCount)
pawnPromotionLevelsCount
- The pawnPromotionLevelsCount to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |