From f3e28d26460592563c55c5d3486182ca71f39355 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Fri, 7 Feb 2025 09:52:09 +0100 Subject: [PATCH] found better terminal condition for v1_simple --- cpp/src/model/ais/v1_simple.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/src/model/ais/v1_simple.cpp b/cpp/src/model/ais/v1_simple.cpp index 74944a3..f391b34 100644 --- a/cpp/src/model/ais/v1_simple.cpp +++ b/cpp/src/model/ais/v1_simple.cpp @@ -31,16 +31,16 @@ Move ai::v1_simple::_search(const Board& b) { } int ai::v1_simple::_search(const Board& b, int depth) { - if (b.is_terminal()) { - if (b.is_checkmate_for(b.white_to_play ? White : Black)) - return -INFINITY; - return 0; - } - if (depth == 0 || stop_computation) return eval(b); std::vector moves = b.all_legal_moves(); + if (moves.size() == 0) { + if (b.is_check_for(b.white_to_play ? White : Black)) + return -INFINITY; + return 0; + } + int best_evaluation = -INFINITY; Move best_move; for (const Move& move : moves) {