From 1834b3b8ce313299aa213df3c8d538d296ea51aa Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sun, 16 Feb 2025 11:13:59 +0100 Subject: [PATCH] fixed the ordering of the moves --- src/model/ais/v3_AB_ordering.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/model/ais/v3_AB_ordering.cpp b/src/model/ais/v3_AB_ordering.cpp index d6f8f3b..e06aa94 100644 --- a/src/model/ais/v3_AB_ordering.cpp +++ b/src/model/ais/v3_AB_ordering.cpp @@ -10,6 +10,12 @@ Move ai::v3_AB_ordering::_search(const Board& b) { std::vector moves = b.all_legal_moves(); + std::sort(moves.begin(), moves.end(), [&](Move& m1, Move& m2) { + int score = m1.score_guess(b) - m2.score_guess(b); + if (!am_white) + score *= -1; + return score < 0; + }); Move best_move; int best_eval = -INFINITY; @@ -69,7 +75,10 @@ int ai::v3_AB_ordering::_ab_search( std::vector moves = b.all_legal_moves(); std::sort(moves.begin(), moves.end(), [&](Move& m1, Move& m2) { - return m1.score_guess(b) > m2.score_guess(b); + int score = m1.score_guess(b) - m2.score_guess(b); + if (!am_white) + score *= -1; + return score < 0; }); Move best_move;