hgducharme / meatball

A C++17 chess engine written entirely from scratch (WIP)
GNU General Public License v2.0
0 stars 0 forks source link

Get basic move generation working #10

Closed hgducharme closed 3 months ago

hgducharme commented 1 year ago

There's no reason to keep a blackOccupancies bitboard inside Chessboard. Change this to blackPieces which holds the location of all black pieces. Same thing for white

EDIT: 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

hgducharme commented 1 year 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

hgducharme commented 1 year ago

Change Bitboard::getBoard to something that better communicates what it's returning, like get64BitInt() or get64BitValue()

hgducharme commented 1 year ago

TODO: Write a test function for the Bitboard & operator overload function. There seems to be something wrong with it

EDIT: done

hgducharme commented 1 year ago

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