found better terminal condition for v1_simple

This commit is contained in:
Karma Riuk 2025-02-07 09:52:09 +01:00
parent 7e888bba61
commit f3e28d2646

View File

@ -31,16 +31,16 @@ Move ai::v1_simple::_search(const Board& b) {
} }
int ai::v1_simple::_search(const Board& b, int depth) { 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) if (depth == 0 || stop_computation)
return eval(b); return eval(b);
std::vector<Move> moves = b.all_legal_moves(); std::vector<Move> 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; int best_evaluation = -INFINITY;
Move best_move; Move best_move;
for (const Move& move : moves) { for (const Move& move : moves) {