Class KGraph

java.lang.Object
ubc.team09.state.KGraph

public class KGraph extends Object
This class includes operations that model the board state as a graph, where
- vertices are board positions, and
- two vertices v and u are adjacent if and only if a king could move from one to the other in a single move.

The king-move definition of edges is the reason for the "K" in the name.
See QGraph
  • Method Summary

    Modifier and Type
    Method
    Description
    static long[]
    neighbors(byte position, long[] occupancy)
    Returns a bitboard with flags for each position adjacent to position.
    static long[]
    neighbors(long[] originalPositions, long[] occupancy)
    Given a set of origins (on a bitboard) and an occupancy board, this returns a board where each position is flagged if and only if it is adjacent to any one of the origins.

    Methods inherited from class Object

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

    • neighbors

      public static long[] neighbors(byte position, long[] occupancy)
      Returns a bitboard with flags for each position adjacent to position.
    • neighbors

      public static long[] neighbors(long[] originalPositions, long[] occupancy)
      Given a set of origins (on a bitboard) and an occupancy board, this returns a board where each position is flagged if and only if it is adjacent to any one of the origins.
      Parameters:
      originalPositions - A bitboard with each possible origin flagged.
      occupancy - A bitboard with each occupied square flagged.