From: snicolet Date: Thu, 18 May 2017 01:23:07 +0000 (-0700) Subject: Do check analysis later in the game X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=c216dcbe7bfc5e326d260d1b7c1271fb4ffc67c9 Do check analysis later in the game The previous patch has added a fraction of the king danger score to the endgame score of the tapered eval, so it seems natural to perform the king danger computation later in the endgame. With this patch we extend the limit of such check analysis down to the material of Rook+Knight, when we have at least two pieces attacking the opponent king zone. Passed STC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 7446 W: 1409 L: 1253 D: 4784 http://tests.stockfishchess.org/tests/view/591c097c0ebc59035df3477c and LTC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 14234 W: 1946 L: 1781 D: 10507 http://tests.stockfishchess.org/tests/view/591c24f10ebc59035df3478c Bench: 5975183 Closes #1121 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index a3f42dbe..06042899 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -240,7 +240,7 @@ namespace { ei.attackedBy[Us][ALL_PIECES] = b | ei.attackedBy[Us][PAWN]; // Init our king safety tables only if we are going to use them - if (pos.non_pawn_material(Them) >= QueenValueMg) + if (pos.non_pawn_material(Them) >= RookValueMg + KnightValueMg) { ei.kingRing[Us] = b; if (relative_rank(Us, pos.square(Us)) == RANK_1) @@ -405,7 +405,7 @@ namespace { Score score = ei.pe->king_safety(pos, ksq); // Main king safety evaluation - if (ei.kingAttackersCount[Them]) + if (ei.kingAttackersCount[Them] > (1 - pos.count(Them))) { // Find the attacked squares which are defended only by our king... undefended = ei.attackedBy[Them][ALL_PIECES] @@ -426,7 +426,8 @@ namespace { + 201 * popcount(undefended) + 143 * (popcount(b) + !!pos.pinned_pieces(Us)) - 848 * !pos.count(Them) - - 28 * mg_value(score) / 25 - 5; + - 9 * mg_value(score) / 8 + + 40; // Analyse the safe enemy's checks which are possible on next move safe = ~pos.pieces(Them);