Closed hgducharme closed 3 months ago
Implement the following overloaded function in Chessboard
Bitboard & getBitboard(Color color);
Bitboard & getBitboard(PieceType piece);
Bitboard & getBitboard(Color color, PieceType piece);
This overloaded function should replace getPieceBitboard
and getColorBitboard
Edit: Done
Change Bitboard::getBoard
to something that better communicates what it's returning, like get64BitInt()
or get64BitValue()
TODO: Write a test function for the Bitboard
&
operator overload function. There seems to be something wrong with it
EDIT: done
Would probably be better to keep a colorBitboards[NUMBER_OF_COLORS]
in chessboard
instead of a whiteOccupied
and a blackOccupied
. This allows us:
// Better?
colorBitboards[color].clearBit(x);
colorBitboards[color].setBit(y)
// Ugly?
switch (color)
{
case WHITE:
{
whiteOccupied_.clearBit(startingSquare);
whiteOccupied_.setBit(endingSquare);
break;
}
case BLACK:
{
blackOccupied_.clearBit(startingSquare);
blackOccupied_.setBit(endingSquare);
break;
}
case NUMBER_OF_COLORS: { break; }
}
EDIT: done
There's no reason to keep a
blackOccupancies
bitboard insideChessboard
. Change this toblackPieces
which holds the location of all black pieces. Same thing for whiteEDIT: Not sure if this is possible. Going to remain with white and black occupancy boards, and then color invariant piece boards. The intersection of a color occupancy board with a piece board gives us the pieces for a specific color