diff --git a/src/evaluate.cpp b/src/evaluate.cpp index fa3b0a72..7d5d435a 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -486,9 +486,13 @@ namespace { - 9 * mg_value(score) / 8 + 40; - // Transform the kingDanger units into a Score, and substract it from the evaluation + // Transform the kingDanger units into a Score, and substract it from the evaluation. if (kingDanger > 0) + { + int mobilityDanger = mg_value(mobility[Them] - mobility[Us]); + kingDanger = std::max(0, kingDanger + mobilityDanger); score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); + } } // King tropism: firstly, find squares that opponent attacks in our king flank