From 660c38f781060f1382b4b0b6e9a8b25658559820 Mon Sep 17 00:00:00 2001 From: Stefan Geschwentner Date: Tue, 15 Sep 2015 05:55:09 -0700 Subject: [PATCH] Scales the endgame score by the number of pawns. Credits goes also to Stephane Nicolet for his great idea of scaling by pawns. STC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 9994 W: 1929 L: 1760 D: 6305 LTC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 11240 W: 1789 L: 1626 D: 7825 bench 7298564 Resolves #423 --- src/evaluate.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 383d9e62..4b08f03b 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -796,6 +796,11 @@ Value Eval::evaluate(const Position& pos) { sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(56) : ScaleFactor(38); } + // Scale endgame by number of pawns + int p = pos.count(WHITE) + pos.count(BLACK); + int v_eg = 1 + abs(int(eg_value(score))); + sf = ScaleFactor(std::max(sf / 2, sf - 7 * SCALE_FACTOR_NORMAL * (14 - p) / v_eg)); + // Interpolate between a middlegame and a (scaled by 'sf') endgame score Value v = mg_value(score) * int(me->game_phase()) + eg_value(score) * int(PHASE_MIDGAME - me->game_phase()) * sf / SCALE_FACTOR_NORMAL; -- 2.39.2