org.vizzini.game.boardgame.chess.standardtoken
Class Pawn

java.lang.Object
  extended by org.vizzini.game.AbstractToken
      extended by org.vizzini.game.boardgame.chess.AbstractChessToken
          extended by org.vizzini.game.boardgame.chess.standardtoken.Pawn
All Implemented Interfaces:
Serializable, Cloneable, IChessToken, IPawn, IBoardGameToken, IToken

public class Pawn
extends AbstractChessToken
implements IPawn

Provides a Pawn for 3D chess.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Field Summary
protected static BitSet[] _blackPossibleEnPassantCapturePositions
          Array of index to possible position bit set for black.
protected static BitSet[] _blackPossibleMoveCapturePositions
          Array of index to possible position bit set for black.
protected static BitSet[] _blackPossibleMovePositions
          Array of index to possible position bit set for black.
protected static BitSet[] _blackPossiblePawnPromotionCapturePositions
          Array of index to possible position bit set for black.
protected static BitSet[] _blackPossiblePawnPromotionPositions
          Array of index to possible position bit set for black.
protected static BitSet[] _whitePossibleEnPassantCapturePositions
          Array of index to possible position bit set for white.
protected static BitSet[] _whitePossibleMoveCapturePositions
          Array of index to possible position bit set for white.
protected static BitSet[] _whitePossibleMovePositions
          Array of index to possible position bit set for white.
protected static BitSet[] _whitePossiblePawnPromotionCapturePositions
          Array of index to possible position bit set for white.
protected static BitSet[] _whitePossiblePawnPromotionPositions
          Array of index to possible position bit set for white.
 
Fields inherited from class org.vizzini.game.boardgame.chess.AbstractChessToken
_emptyBitSet, ONES, TWOS, ZERO
 
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
Pawn()
          Construct this object with no agent as this token's owner.
 
Method Summary
protected static void addPossiblePosition(IChessEnvironment board, BitSet bitSet, int x, int y, int z, int dx, int dy, int dz, boolean isPromotion, boolean isWhite)
          Add the positions generated by the deltas to the possible positions list.
 void configure(Properties properties, int index)
          Configure this token.
protected static void generatePossibleEnPassantCapturePositions(BitSet bitSet, IChessEnvironment board, int index, boolean isWhite, ITeam team)
          Fill the possible positions list.
protected static void generatePossibleMoveCapturePositions(BitSet bitSet, IChessEnvironment board, int index, boolean isWhite, ITeam team, boolean isPromotion)
          Fill the possible positions list.
protected static void generatePossibleMovePositions(BitSet bitSet, IChessEnvironment board, int index, boolean isWhite, ITeam team, boolean isPromotion)
          Fill the possible positions list.
protected static BitSet[] getBlackPossibleEnPassantCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getBlackPossibleMoveCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getBlackPossibleMovePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getBlackPossiblePawnPromotionCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getBlackPossiblePawnPromotionPositionsArray(IChessEnvironment board)
          Return the possible positions array.
 List getPossibleActions(IAgent agent0, IEnvironment environment, IAdjudicator adjudicator)
          Return a list of possible legal agent actions.
 BitSet getPossibleEnPassantCapturePositions(IChessEnvironment board)
          Return a list of the possible en passant capture positions this token could take.
protected static BitSet[] getPossibleEnPassantCapturePositionsArray(IChessEnvironment board, boolean isWhite)
          Return the possible positions array.
 BitSet getPossibleMoveCapturePositions(IChessEnvironment board)
          Return a list of the possible move capture positions this token could take.
protected static BitSet[] getPossibleMoveCapturePositionsArray(IChessEnvironment board, boolean isWhite)
          Return the possible positions array.
 BitSet getPossibleMovePositions(IChessEnvironment board)
          Return a list of the possible positions this token could take.
protected static BitSet[] getPossibleMovePositionsArray(IChessEnvironment board, boolean isWhite)
          Return the possible positions array.
 BitSet getPossiblePawnPromotionCapturePositions(IChessEnvironment board)
          Return a list of the possible pawn promotion capture positions this token could take.
protected static BitSet[] getPossiblePawnPromotionCapturePositionsArray(IChessEnvironment board, boolean isWhite)
          Return the possible positions array.
 BitSet getPossiblePawnPromotionPositions(IChessEnvironment board)
          Return a list of the possible pawn promotion positions this token could take.
protected static BitSet[] getPossiblePawnPromotionPositionsArray(IChessEnvironment board, boolean isWhite)
          Return the possible positions array.
protected static BitSet[] getWhitePossibleEnPassantCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getWhitePossibleMoveCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getWhitePossibleMovePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getWhitePossiblePawnPromotionCapturePositionsArray(IChessEnvironment board)
          Return the possible positions array.
protected static BitSet[] getWhitePossiblePawnPromotionPositionsArray(IChessEnvironment board)
          Return the possible positions array.
 boolean isAttackPosition(IntegerPosition position)
          Return true if the given position is an attack move for this.
static boolean isDoubleFirstMove()
           
protected static boolean isInPromotionRange(IChessEnvironment board, IntegerPosition toPosition, boolean isWhite)
          Return true if this is in promotion range.
static boolean isSideways()
          Return true if this uses the sideways move.
static boolean isTriagonal()
          Return true if this uses the triagonal move.
static void reset()
          Reset cached data.
static void setDoubleFirstMove(boolean isDoubleFirstMove)
           
static void setSideways(boolean isSideways)
          Set the sideways flag.
static void setTriagonal(boolean isTriagonal)
          Set the triagonal flag.
 
Methods inherited from class org.vizzini.game.boardgame.chess.AbstractChessToken
addCastleActions, addEnPassantCaptureActions, addMoveActions, addMoveCaptureActions, addPawnPromotionActions, addPawnPromotionCaptureActions, addPossiblePosition, addPossiblePositions, copy, createCastleAction, createEnPassantCaptureAction, createMoveAction, createMoveCaptureAction, createPawnPromotionAction, createPawnPromotionCaptureAction, getCounters, getEmptyBitSet, getPossibleCastlePositions, isPossibleCastlePosition, isPossibleEnPassantCapturePosition, isPossibleMoveCapturePosition, isPossibleMovePosition, isPossiblePawnPromotionCapturePosition, isPossiblePawnPromotionPosition, isWhite, setTeam
 
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.IPawn
isPossibleEnPassantCapturePosition, isPossiblePawnPromotionCapturePosition, isPossiblePawnPromotionPosition
 
Methods inherited from interface org.vizzini.game.boardgame.chess.IChessToken
isPossibleMoveCapturePosition, isPossibleMovePosition, isWhite
 
Methods inherited from interface org.vizzini.game.IToken
addPropertyChangeListener, clone, getAgent, getIndex, getName, getPosition, getTeam, getValue, removePropertyChangeListener, setAgent, setName, setPosition, setTeam, setValue
 

Field Detail

_whitePossibleMovePositions

protected static BitSet[] _whitePossibleMovePositions
Array of index to possible position bit set for white.


_blackPossibleMovePositions

protected static BitSet[] _blackPossibleMovePositions
Array of index to possible position bit set for black.


_whitePossibleEnPassantCapturePositions

protected static BitSet[] _whitePossibleEnPassantCapturePositions
Array of index to possible position bit set for white.


_blackPossibleEnPassantCapturePositions

protected static BitSet[] _blackPossibleEnPassantCapturePositions
Array of index to possible position bit set for black.


_whitePossibleMoveCapturePositions

protected static BitSet[] _whitePossibleMoveCapturePositions
Array of index to possible position bit set for white.


_blackPossibleMoveCapturePositions

protected static BitSet[] _blackPossibleMoveCapturePositions
Array of index to possible position bit set for black.


_whitePossiblePawnPromotionPositions

protected static BitSet[] _whitePossiblePawnPromotionPositions
Array of index to possible position bit set for white.


_blackPossiblePawnPromotionPositions

protected static BitSet[] _blackPossiblePawnPromotionPositions
Array of index to possible position bit set for black.


_whitePossiblePawnPromotionCapturePositions

protected static BitSet[] _whitePossiblePawnPromotionCapturePositions
Array of index to possible position bit set for white.


_blackPossiblePawnPromotionCapturePositions

protected static BitSet[] _blackPossiblePawnPromotionCapturePositions
Array of index to possible position bit set for black.

Constructor Detail

Pawn

public Pawn()
Construct this object with no agent as this token's owner.

Since:
v0.3
Method Detail

isDoubleFirstMove

public static boolean isDoubleFirstMove()
Returns:
Return _isDoubleFirstMove.
Since:
v0.3

isSideways

public static boolean isSideways()
Return true if this uses the sideways move.

Since:
v0.3

isTriagonal

public static boolean isTriagonal()
Return true if this uses the triagonal move.

Since:
v0.3

reset

public static void reset()
Reset cached data.

Since:
v0.3

setDoubleFirstMove

public static void setDoubleFirstMove(boolean isDoubleFirstMove)
Parameters:
isDoubleFirstMove - The _isDoubleFirstMove to set.
Since:
v0.3

setSideways

public static void setSideways(boolean isSideways)
Set the sideways flag.

Since:
v0.3

setTriagonal

public static void setTriagonal(boolean isTriagonal)
Set the triagonal flag.

Since:
v0.3

configure

public void configure(Properties properties,
                      int index)
Configure this token.

Specified by:
configure in interface IToken
Overrides:
configure in class AbstractChessToken
Parameters:
properties - Source of configuration information.
index - Index of this token's properties.
Since:
v0.3

getPossibleActions

public List getPossibleActions(IAgent agent0,
                               IEnvironment environment,
                               IAdjudicator adjudicator)
Return a list of possible legal agent actions. Extends the super method for pawn promotion, pawn promotion capture, and en passant capture actions.

Specified by:
getPossibleActions in interface IBoardGameToken
Overrides:
getPossibleActions in class AbstractChessToken
Parameters:
agent0 - Agent.
environment - The current environment.
adjudicator - Adjudicator for determining legal actions.
Since:
v0.3

getPossibleEnPassantCapturePositions

public BitSet getPossibleEnPassantCapturePositions(IChessEnvironment board)
Return a list of the possible en passant capture positions this token could take.

Specified by:
getPossibleEnPassantCapturePositions in interface IPawn
Overrides:
getPossibleEnPassantCapturePositions in class AbstractChessToken
Parameters:
board - Chess board.
Since:
v0.3

getPossibleMoveCapturePositions

public BitSet getPossibleMoveCapturePositions(IChessEnvironment board)
Return a list of the possible move capture positions this token could take.

Specified by:
getPossibleMoveCapturePositions in interface IChessToken
Parameters:
board - Chess board.
Since:
v0.3

getPossibleMovePositions

public BitSet getPossibleMovePositions(IChessEnvironment board)
Return a list of the possible positions this token could take.

Specified by:
getPossibleMovePositions in interface IChessToken
Parameters:
board - Chess board.
Since:
v0.3

getPossiblePawnPromotionCapturePositions

public BitSet getPossiblePawnPromotionCapturePositions(IChessEnvironment board)
Return a list of the possible pawn promotion capture positions this token could take.

Specified by:
getPossiblePawnPromotionCapturePositions in interface IPawn
Overrides:
getPossiblePawnPromotionCapturePositions in class AbstractChessToken
Parameters:
board - Chess board.
Since:
v0.3

getPossiblePawnPromotionPositions

public BitSet getPossiblePawnPromotionPositions(IChessEnvironment board)
Return a list of the possible pawn promotion positions this token could take.

Specified by:
getPossiblePawnPromotionPositions in interface IPawn
Overrides:
getPossiblePawnPromotionPositions in class AbstractChessToken
Parameters:
board - Chess board.
Since:
v0.3

isAttackPosition

public boolean isAttackPosition(IntegerPosition position)
Return true if the given position is an attack move for this.

Specified by:
isAttackPosition in interface IPawn
Since:
v0.3

addPossiblePosition

protected static void addPossiblePosition(IChessEnvironment board,
                                          BitSet bitSet,
                                          int x,
                                          int y,
                                          int z,
                                          int dx,
                                          int dy,
                                          int dz,
                                          boolean isPromotion,
                                          boolean isWhite)
Add the positions generated by the deltas to the possible positions list.

Since:
v0.3

generatePossibleEnPassantCapturePositions

protected static void generatePossibleEnPassantCapturePositions(BitSet bitSet,
                                                                IChessEnvironment board,
                                                                int index,
                                                                boolean isWhite,
                                                                ITeam team)
Fill the possible positions list.

Parameters:
board - Grid board environment.
index - Token position as an index.
Since:
v0.3

generatePossibleMoveCapturePositions

protected static void generatePossibleMoveCapturePositions(BitSet bitSet,
                                                           IChessEnvironment board,
                                                           int index,
                                                           boolean isWhite,
                                                           ITeam team,
                                                           boolean isPromotion)
Fill the possible positions list.

Parameters:
board - Grid board environment.
index - Token position as an index.
Since:
v0.3

generatePossibleMovePositions

protected static void generatePossibleMovePositions(BitSet bitSet,
                                                    IChessEnvironment board,
                                                    int index,
                                                    boolean isWhite,
                                                    ITeam team,
                                                    boolean isPromotion)
Fill the possible positions list.

Parameters:
board - Grid board environment.
index - Token position as an index.
Since:
v0.3

getBlackPossibleEnPassantCapturePositionsArray

protected static BitSet[] getBlackPossibleEnPassantCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getBlackPossibleMoveCapturePositionsArray

protected static BitSet[] getBlackPossibleMoveCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getBlackPossibleMovePositionsArray

protected static BitSet[] getBlackPossibleMovePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getBlackPossiblePawnPromotionCapturePositionsArray

protected static BitSet[] getBlackPossiblePawnPromotionCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getBlackPossiblePawnPromotionPositionsArray

protected static BitSet[] getBlackPossiblePawnPromotionPositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getPossibleEnPassantCapturePositionsArray

protected static BitSet[] getPossibleEnPassantCapturePositionsArray(IChessEnvironment board,
                                                                    boolean isWhite)
Return the possible positions array.

Since:
v0.3

getPossibleMoveCapturePositionsArray

protected static BitSet[] getPossibleMoveCapturePositionsArray(IChessEnvironment board,
                                                               boolean isWhite)
Return the possible positions array.

Since:
v0.3

getPossibleMovePositionsArray

protected static BitSet[] getPossibleMovePositionsArray(IChessEnvironment board,
                                                        boolean isWhite)
Return the possible positions array.

Since:
v0.3

getPossiblePawnPromotionCapturePositionsArray

protected static BitSet[] getPossiblePawnPromotionCapturePositionsArray(IChessEnvironment board,
                                                                        boolean isWhite)
Return the possible positions array.

Since:
v0.3

getPossiblePawnPromotionPositionsArray

protected static BitSet[] getPossiblePawnPromotionPositionsArray(IChessEnvironment board,
                                                                 boolean isWhite)
Return the possible positions array.

Since:
v0.3

getWhitePossibleEnPassantCapturePositionsArray

protected static BitSet[] getWhitePossibleEnPassantCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getWhitePossibleMoveCapturePositionsArray

protected static BitSet[] getWhitePossibleMoveCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getWhitePossibleMovePositionsArray

protected static BitSet[] getWhitePossibleMovePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getWhitePossiblePawnPromotionCapturePositionsArray

protected static BitSet[] getWhitePossiblePawnPromotionCapturePositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

getWhitePossiblePawnPromotionPositionsArray

protected static BitSet[] getWhitePossiblePawnPromotionPositionsArray(IChessEnvironment board)
Return the possible positions array.

Since:
v0.3

isInPromotionRange

protected static boolean isInPromotionRange(IChessEnvironment board,
                                            IntegerPosition toPosition,
                                            boolean isWhite)
Return true if this is in promotion range.

Parameters:
board - Chess board.
toPosition - To position.
isWhite - Flag indicating if this is owned by White.


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02