Class KGraph
java.lang.Object
ubc.team09.state.KGraph
This class includes operations that model the board state as a graph, where
- vertices are board positions, and
- two vertices
The king-move definition of edges is the reason for the "K" in the name.
See
- 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 TypeMethodDescriptionstatic long[]neighbors(byte position, long[] occupancy) Returns a bitboard with flags for each position adjacent toposition.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.
-
Method Details
-
neighbors
public static long[] neighbors(byte position, long[] occupancy) Returns a bitboard with flags for each position adjacent toposition. -
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.
-