Class State
java.lang.Object
ubc.team09.state.State
Represents a complete game state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal byteThe player who can make a move from this position.final intThe move that created this board state.final long[]An occupancy board; i.e., a bitboard that has a flag wherever there is a queen or an arrow.final byte[]The position indices of the queens on the board. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchildren()Returns a generator which yields all possible child states.copy()Returns a copy of this state.voidimpose(BoardState newState) Updates this board's occupancy and queen positions to match the given board.
-
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. -
activePlayer
public final byte activePlayerThe player who can make a move from this position. -
move
public final int moveThe move that created this board state. SeeMove
-
-
Constructor Details
-
State
public State(long[] occupancy, byte[] queens, byte activePlayer, int move) Creates a new game state.- Parameters:
occupancy- A bitboard with each occupied square (i.e., any square with an arrow or a queen) flagged.queens- The position indices (0-99) of the eight queens on the board. It must be maintained that the first four queens are White's queens, and the latter four are Black's.activePlayer- The player whose turn it is in this state; i.e., who will make the next move. UseC.WHITEorC.BLACK.move- The integer representation of the most recent move. SeeMove.
-
State
-
-
Method Details
-
children
Returns a generator which yields all possible child states. -
copy
Returns a copy of this state. -
impose
Updates this board's occupancy and queen positions to match the given board.
-