Class BoardState
java.lang.Object
ubc.team09.state.BoardState
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBoardState(long[] occupancy, byte[] queens) Creates a new minimal state.BoardState(BoardState prev, int move) Creates a new state by applying the given move to an old state. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(BoardState state) Returnstrueif and only if the given state has the same occupancy board and queen positions as this object.static BoardStateinitial()Creates the initial board state.booleanisConsistentWith(State state) Returnstrueif and only if the given state has the same occupancy board and queen positions as this object.booleanisTerminal(byte activePlayer) Returnstrueif and only if there are no moves that could be made from this position.
-
Field Details
-
occupancy
public final long[] occupancyAn occupancy board; i.e., a bitboard that has a flag wherever there is a queen or an arrow. If a position is not flagged on this board, then it means that position is empty. -
queens
public final byte[] queensThe position indices of the queens on the board. The first four are White's queens, and the last four are Black's.
-
-
Constructor Details
-
BoardState
public BoardState(long[] occupancy, byte[] queens) Creates a new minimal state. The arguments given are directly given to the state's fields, without being copied, so it's important that they are not mutated.- Parameters:
occupancy-queens-
-
BoardState
Creates a new state by applying the given move to an old state.
-
-
Method Details
-
isConsistentWith
Returnstrueif and only if the given state has the same occupancy board and queen positions as this object.- Parameters:
state- The full state to consider.
-
equals
Returnstrueif and only if the given state has the same occupancy board and queen positions as this object.- Parameters:
state- The state to consider.
-
isTerminal
public boolean isTerminal(byte activePlayer) Returnstrueif and only if there are no moves that could be made from this position. -
initial
Creates the initial board state.
-