Class P
java.lang.Object
ubc.team09.bitboard.P
This class stores precomputed (abbreviated to "P" for convenience)
bitboards.
The bitboards were generated by the script in the
[scripts/](https://github.com/Chad-Glazier/edi/tree/main/scripts) directory,
see the README there for more information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteRepresents the "East" direction; i.e., greater column indices.static final long[][][]A matrix that stores the bitboards that represent rays a queen can move along based on (1) the starting position index and (2) the direction of the move.static final long[][]A matrix that stores the squares that are adjacent to the indexed position, meaning that a chess King could move from the position to any of the flagged positions.static final byteRepresents the "North" direction; i.e., lesser row indices.static final byteRepresents the "Northeast" direction.static final byteRepresents the "Northwest" direction.static final long[][][]A matrix that stores the bitboards that represent rays a queen can move along based on (1) the starting position index and (2) the direction of the move.static final byteRepresnts the "South" direction; i.e., greater row indices.static final byteRepresents the "Southeast" direction.static final long[][]Stores bitboards that have only a single square flagged; the indexed position.static final byteRepresents the "Southwest" direction.static final byteRepresents the "West" direction; i.e., lesser column indices. -
Method Summary
-
Field Details
-
W
public static final byte WRepresents the "West" direction; i.e., lesser column indices.- See Also:
-
NW
public static final byte NWRepresents the "Northwest" direction.- See Also:
-
N
public static final byte NRepresents the "North" direction; i.e., lesser row indices.- See Also:
-
NE
public static final byte NERepresents the "Northeast" direction.- See Also:
-
E
public static final byte ERepresents the "East" direction; i.e., greater column indices.- See Also:
-
SE
public static final byte SERepresents the "Southeast" direction.- See Also:
-
S
public static final byte SRepresnts the "South" direction; i.e., greater row indices.- See Also:
-
SW
public static final byte SWRepresents the "Southwest" direction.- See Also:
-
kingAttack
public static final long[][] kingAttackA matrix that stores the squares that are adjacent to the indexed position, meaning that a chess King could move from the position to any of the flagged positions.
For example, if you want all of the squares adjacent to the position (1, 1), you would use:long[] adjacentSquares = P.kingAttack[11]; -
ray
public static final long[][][] rayA matrix that stores the bitboards that represent rays a queen can move along based on (1) the starting position index and (2) the direction of the move. E.g., to get the move bitboard for a queen at position 32 moving North, you would access:long[] ray = P.ray[32][P.N]; -
inclusiveRay
public static final long[][][] inclusiveRayA matrix that stores the bitboards that represent rays a queen can move along based on (1) the starting position index and (2) the direction of the move. E.g., to get the move bitboard for a queen at position 32 moving North, you would access:
This matrix is distinct fromlong[] ray = P.ray[32][P.N];raybecause this one includes the given position as part of the ray. You shouldn't typically use this for queen movements, but it may be useful in calculating the ray segment that should be removed due to a blocker. Note: The index P.ray[100] is defined for all directions, but only holds empty boards. -
square
public static final long[][] squareStores bitboards that have only a single square flagged; the indexed position. E.g., if you want a bitboard with only a single flag at the position index 12, you would uselong[] square = P.square[12];
-