A bitboard is a specialized bit array data structure commonly used in computer systems that play board games, where each bit corresponds to a game board space or piece. This allows parallel bitwise operations to set or query the game state, or determine moves or plays in the game.
public long SetCellState(long bitboard, int row, int col)
{
long newBit = 1L << (row * 8 + col);
return (bitboard |= newBit);
}
public bool GetCellState(long bitboard, int row, int col)
{
long mask = 1L << (row * 8 + col);
return ((bitboard & mask) != 0);
}