Class P

java.lang.Object
ubc.team09.bitboard.P

public class P extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Represents 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 byte
    Represents the "North" direction; i.e., lesser row indices.
    static final byte
    Represents the "Northeast" direction.
    static final byte
    Represents 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 byte
    Represnts the "South" direction; i.e., greater row indices.
    static final byte
    Represents the "Southeast" direction.
    static final long[][]
    Stores bitboards that have only a single square flagged; the indexed position.
    static final byte
    Represents the "Southwest" direction.
    static final byte
    Represents the "West" direction; i.e., lesser column indices.
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • W

      public static final byte W
      Represents the "West" direction; i.e., lesser column indices.
      See Also:
    • NW

      public static final byte NW
      Represents the "Northwest" direction.
      See Also:
    • N

      public static final byte N
      Represents the "North" direction; i.e., lesser row indices.
      See Also:
    • NE

      public static final byte NE
      Represents the "Northeast" direction.
      See Also:
    • E

      public static final byte E
      Represents the "East" direction; i.e., greater column indices.
      See Also:
    • SE

      public static final byte SE
      Represents the "Southeast" direction.
      See Also:
    • S

      public static final byte S
      Represnts the "South" direction; i.e., greater row indices.
      See Also:
    • SW

      public static final byte SW
      Represents the "Southwest" direction.
      See Also:
    • kingAttack

      public static final long[][] kingAttack
      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.

      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[][][] ray
      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. 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[][][] inclusiveRay
      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. 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];
      
      This matrix is distinct from ray because 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[][] square
      Stores 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 use
      long[] square = P.square[12];