|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.game.AbstractToken
org.vizzini.game.boardgame.chess.AbstractChessToken
public abstract class AbstractChessToken
Provides base functionality for 2D and 3D chess tokens.
Field Summary | |
---|---|
protected static BitSet |
_emptyBitSet
An empty bit set. |
protected static int[] |
ONES
Delta array used for possible position generation. |
protected static int[] |
TWOS
Delta array used for possible position generation. |
protected static int[] |
ZERO
Delta array used for possible position generation. |
Fields inherited from class org.vizzini.game.AbstractToken |
---|
UNKNOWN_NAME |
Fields inherited from interface org.vizzini.game.IToken |
---|
AGENT_PROPERTY, NAME_PROPERTY, POSITION_PROPERTY, TEAM_PROPERTY |
Constructor Summary | |
---|---|
AbstractChessToken()
TEMP: implement counters. |
Method Summary | |
---|---|
protected void |
addCastleActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition kingFromPosition,
BitSet toBits)
Add castle actions using the given parameters. |
protected void |
addEnPassantCaptureActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition fromPosition,
BitSet toBits)
Add en passant capture actions using the given parameters. |
protected void |
addMoveActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition fromPosition,
BitSet toBits)
Add move actions using the given parameters. |
protected void |
addMoveCaptureActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition fromPosition,
BitSet toBits)
Add move capture actions using the given parameters. |
protected void |
addPawnPromotionActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition fromPosition,
BitSet toBits,
Class tokenClass)
Add pawn promotion actions using the given parameters. |
protected void |
addPawnPromotionCaptureActions(List list,
IChessEnvironment board,
IChessAgent agent,
IChessAdjudicator adjudicator,
IntegerPosition fromPosition,
BitSet toBits,
Class tokenClass)
Add pawn promotion capture actions using the given parameters. |
protected static void |
addPossiblePosition(IChessEnvironment board,
BitSet bitSet,
int x,
int y,
int z,
int dx,
int dy,
int dz)
Add the positions generated by the deltas to the possible positions list. |
protected static void |
addPossiblePositions(IChessEnvironment board,
BitSet bitSet,
int x,
int y,
int z,
int[] dx,
int[] dy,
int[] dz)
Add the positions generated by the deltas to the possible positions list. |
void |
configure(Properties properties,
int index)
Configure this token. |
void |
copy(IToken token)
Copy data from the given instance. |
protected IAction |
createCastleAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition kingFromPosition,
IntegerPosition kingToPosition,
IntegerPosition rookFromPosition,
IntegerPosition rookToPosition)
Create a castle action for the given parameters. |
protected IAction |
createEnPassantCaptureAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition capturePosition,
IntegerPosition toPosition)
Create an en passant capture action for the given parameters. |
protected IAction |
createMoveAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Create a move action for the given parameters. |
protected IAction |
createMoveCaptureAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition)
Create a move capture action for the given parameters. |
protected IAction |
createPawnPromotionAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition,
Class tokenClass)
Create a pawn promotion action for the given parameters. |
protected IAction |
createPawnPromotionCaptureAction(IChessEnvironment board,
IChessAdjudicator adjudicator,
IChessAgent agent,
IntegerPosition fromPosition,
IntegerPosition toPosition,
Class tokenClass)
Create a pawn promotion capture action for the given parameters. |
static int[] |
getCounters()
TEMP: return counters. |
protected static BitSet |
getEmptyBitSet(IChessEnvironment board)
Return an empty bit set. |
List |
getPossibleActions(IAgent agent0,
IEnvironment environment,
IAdjudicator adjudicator)
Return a list of possible legal agent actions. |
BitSet |
getPossibleCastlePositions(IChessEnvironment board)
Return a list of the possible castle positions this token could take. |
BitSet |
getPossibleEnPassantCapturePositions(IChessEnvironment board)
Return a list of the possible en passant capture positions this token could take. |
BitSet |
getPossiblePawnPromotionCapturePositions(IChessEnvironment board)
Return a list of the possible pawn promotion capture positions this token could take. |
BitSet |
getPossiblePawnPromotionPositions(IChessEnvironment board)
Return a list of the possible pawn promotion positions this token could take. |
boolean |
isPossibleCastlePosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isPossibleEnPassantCapturePosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isPossibleMoveCapturePosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isPossibleMovePosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isPossiblePawnPromotionCapturePosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isPossiblePawnPromotionPosition(IChessEnvironment board,
IntegerPosition position)
Return true if the given position is possible for this token. |
boolean |
isWhite()
Return true if this token's team is white. |
void |
setTeam(ITeam team)
Set the associated team. |
Methods inherited from class org.vizzini.game.AbstractToken |
---|
addPropertyChangeListener, clone, equals, getAgent, getIndex, getName, getPosition, getPropertyChangeManager, getTeam, getValue, hashCode, isFiringPositionChanges, removePropertyChangeListener, setAgent, setFiringPositionChanges, setIndex, setName, setPosition, setValue, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.vizzini.game.boardgame.chess.IChessToken |
---|
getPossibleMoveCapturePositions, getPossibleMovePositions |
Methods inherited from interface org.vizzini.game.IToken |
---|
addPropertyChangeListener, clone, getAgent, getIndex, getName, getPosition, getTeam, getValue, removePropertyChangeListener, setAgent, setName, setPosition, setValue |
Field Detail |
---|
protected static final int[] ONES
protected static final int[] ZERO
protected static final int[] TWOS
protected static BitSet _emptyBitSet
Constructor Detail |
---|
public AbstractChessToken()
Method Detail |
---|
public static int[] getCounters()
public void configure(Properties properties, int index)
configure
in interface IToken
configure
in class AbstractToken
properties
- Source of configuration information.index
- Index of this token's properties.public void copy(IToken token)
copy
in class AbstractToken
public List getPossibleActions(IAgent agent0, IEnvironment environment, IAdjudicator adjudicator)
getPossibleActions
in interface IBoardGameToken
agent0
- Agent.environment
- The current environment.adjudicator
- Adjudicator for determining legal actions.public BitSet getPossibleCastlePositions(IChessEnvironment board)
board
- Chess board.public BitSet getPossibleEnPassantCapturePositions(IChessEnvironment board)
board
- Chess board.public BitSet getPossiblePawnPromotionCapturePositions(IChessEnvironment board)
board
- Chess board.public BitSet getPossiblePawnPromotionPositions(IChessEnvironment board)
board
- Chess board.public boolean isPossibleCastlePosition(IChessEnvironment board, IntegerPosition position)
board
- Chess board.position
- Position.public boolean isPossibleEnPassantCapturePosition(IChessEnvironment board, IntegerPosition position)
board
- Chess board.position
- Position.public boolean isPossibleMoveCapturePosition(IChessEnvironment board, IntegerPosition position)
isPossibleMoveCapturePosition
in interface IChessToken
board
- Chess board.position
- Position.public boolean isPossibleMovePosition(IChessEnvironment board, IntegerPosition position)
isPossibleMovePosition
in interface IChessToken
board
- Chess board.position
- Position.public boolean isPossiblePawnPromotionCapturePosition(IChessEnvironment board, IntegerPosition position)
board
- Chess board.position
- Position.public boolean isPossiblePawnPromotionPosition(IChessEnvironment board, IntegerPosition position)
board
- Chess board.position
- Position.public boolean isWhite()
isWhite
in interface IChessToken
public void setTeam(ITeam team)
setTeam
in interface IToken
setTeam
in class AbstractToken
team
- The associated team. Can be null.protected static void addPossiblePosition(IChessEnvironment board, BitSet bitSet, int x, int y, int z, int dx, int dy, int dz)
protected static void addPossiblePositions(IChessEnvironment board, BitSet bitSet, int x, int y, int z, int[] dx, int[] dy, int[] dz)
protected static final BitSet getEmptyBitSet(IChessEnvironment board)
board
- Chess board.protected void addCastleActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition kingFromPosition, BitSet toBits)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.kingFromPosition
- King from position.toBits
- To positions bit set.protected void addEnPassantCaptureActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition fromPosition, BitSet toBits)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.fromPosition
- From position.toBits
- To positions bit set.protected void addMoveActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition fromPosition, BitSet toBits)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.fromPosition
- From position.toBits
- To positions bit set.protected void addMoveCaptureActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition fromPosition, BitSet toBits)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.fromPosition
- From position.toBits
- To positions bit set.protected void addPawnPromotionActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition fromPosition, BitSet toBits, Class tokenClass)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.fromPosition
- From position.toBits
- To positions bit set.tokenClass
- Promotion token class.protected void addPawnPromotionCaptureActions(List list, IChessEnvironment board, IChessAgent agent, IChessAdjudicator adjudicator, IntegerPosition fromPosition, BitSet toBits, Class tokenClass)
list
- Actions list.board
- Chess board.agent
- Chess agent.adjudicator
- Chess adjudicator.fromPosition
- From position.toBits
- To positions bit set.tokenClass
- Promotion token class.protected IAction createCastleAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition kingFromPosition, IntegerPosition kingToPosition, IntegerPosition rookFromPosition, IntegerPosition rookToPosition)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.kingFromPosition
- King from position.kingToPosition
- King to position.rookFromPosition
- Rook from position.rookToPosition
- Rook to position.protected IAction createEnPassantCaptureAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition capturePosition, IntegerPosition toPosition)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.protected IAction createMoveAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.protected IAction createMoveCaptureAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.protected IAction createPawnPromotionAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition, Class tokenClass)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.tokenClass
- Promotion token class.protected IAction createPawnPromotionCaptureAction(IChessEnvironment board, IChessAdjudicator adjudicator, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition, Class tokenClass)
board
- Chess environment.adjudicator
- Chess adjudicator.agent
- Chess agent.fromPosition
- From position.toPosition
- To position.tokenClass
- Promotion token class.
|
||||||||||
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 |