diff options
Diffstat (limited to 'src/bot.cpp')
| -rw-r--r-- | src/bot.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bot.cpp b/src/bot.cpp index b09a704..7b937bd 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -84,10 +84,10 @@ static int ScoreMove(const Game *board, const uint16_t &move, return score; } -static std::vector<uint16_t> GetSortedLegalMoves(Game *g, - bool generateQuietMoves, - const uint16_t *bestMove) { - auto moves = GetLegalMoves(g, generateQuietMoves); +static std::vector<uint16_t> +GetSortedLegalMoves(Game *g, const move_generate_options &options, + const uint16_t *bestMove) { + auto moves = GetLegalMoves(g, options); std::ranges::sort(moves, [&](const uint16_t &a, const uint16_t &c) { return ScoreMove(g, a, bestMove) > ScoreMove(g, c, bestMove); }); @@ -134,7 +134,7 @@ static int quiescenceSearch(Game *b, int qdepth, int alpha, int beta, int ply) { } alpha = std::max(alpha, standPat); - auto moves = GetSortedLegalMoves(b, false, nullptr); + auto moves = GetSortedLegalMoves(b, CAPTUARES_ONLY, nullptr); for (uint16_t move : moves) { Undo undo = MakeMove(move, b); @@ -200,10 +200,10 @@ static int search(int depth, Game *b, int alpha, int beta, int ply) { } uint16_t ttBestMove = entry != nullptr ? entry->bestMove : uint16_t{}; - std::vector<uint16_t> moves = GetSortedLegalMoves(b, true, &ttBestMove); + std::vector<uint16_t> moves = GetSortedLegalMoves(b, ALL, &ttBestMove); if (moves.empty()) { - if (IsSquareAttacked(b, FindKing(b, b->turn), !b->turn)) { + if (IsSquareAttacked(*b, FindKing(*b, b->turn), !b->turn)) { return -(MATE - ply); // mated } return 0; // stalemate @@ -256,7 +256,7 @@ struct SearchResult { */ static SearchResult SearchDepth(Game *b, int depth, const uint16_t *previousBest) { - auto moves = GetSortedLegalMoves(b, true, previousBest); + auto moves = GetSortedLegalMoves(b, ALL, previousBest); if (moves.empty()) { return { @@ -325,7 +325,7 @@ uint16_t GetBestMove(Game *b, int maxDepth, move_options options) { bool hasSetSpecialTimeLimit = false; - auto legalMoves = GetSortedLegalMoves(b, true, nullptr); + auto legalMoves = GetSortedLegalMoves(b, ALL, nullptr); if (legalMoves.empty()) { assert(false && "GetBestMove called with no legal moves"); return {}; |
