Implement Search

This commit is contained in:
2022-12-23 18:34:34 +01:00
parent bcf4d66c49
commit 87adca7e66
15 changed files with 337 additions and 66 deletions

View File

@@ -21,13 +21,11 @@ public:
using MoveVec = std::vector<Move>;
Board() = default;
Board(const Board &) = default;
Board(Board &&other) = default;
Board &operator=(const Board &) = default;
Board &operator=(Board &&) = default;
void setPiece(const Square &square, const Piece::Optional &piece);
Piece::Optional piece(const Square &square) const;
std::vector<Piece> pieces(PieceColor color) const;
int evaluate() const;
void setTurn(PieceColor turn);
PieceColor turn() const;
void setCastlingRights(CastlingRights cr);
@@ -47,6 +45,9 @@ public:
return static_cast<int>(c);
}
bool isCheckMate() const;
private:
BitBoard mPieceBBs[BB_NUM] = {};
@@ -56,6 +57,8 @@ private:
CastlingRights mCR = CastlingRights::None;
std::optional<Square> mEPS;
constexpr static const int mPieceValue[8] = {0,0, 100, 350, 350, 525, 1000, 10000};
void handleCastlingRights(const Piece &piece, const BitBoard &bb);
// Check if the move is castling without checking the rights or validity.
@@ -83,6 +86,7 @@ private:
void handlePawnDoubleAdvance(const Move &move, BitBoard bb, const Piece &movedPiece);
void handleEnPassant(const Move &move, const Piece &movedPiece);
int evaluate(const PieceColor color) const;
};
std::ostream &operator<<(std::ostream &os, const Board &board);