From 1d3efff47274bd03d4deced8d7ba0360bd1dba8a Mon Sep 17 00:00:00 2001 From: Alain SAVARD Date: Mon, 27 Jan 2020 09:25:41 -0500 Subject: [PATCH] Dynamic Complexity based on psqt Adjust initiative score by psqt/2 instead of materialScore/2 which simplifies #2516 Passed STC http://tests.stockfishchess.org/tests/view/5e2e667dab2d69d58394fc73 LLR: 2.94 (-2.94,2.94) {-1.50,0.50} Total: 23198 W: 4506 L: 4353 D: 14339 Ptnml(0-2): 396, 2615, 5380, 2728, 418 Passed LTC http://tests.stockfishchess.org/tests/view/5e2ed75cab2d69d58394fcbf LLR: 2.94 (-2.94,2.94) {-1.50,0.50} Total: 8519 W: 1179 L: 1062 D: 6278 Ptnml(0-2): 50, 775, 2472, 843, 74 closes https://github.com/official-stockfish/Stockfish/pull/2522 Bench: 4684459 --- src/evaluate.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index be39f8a7..8d7976d5 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -168,7 +168,7 @@ namespace { template Score passed() const; template Score space() const; ScaleFactor scale_factor(Value eg) const; - Score initiative(Score score, Score materialScore) const; + Score initiative(Score score) const; const Position& pos; Material::Entry* me; @@ -696,7 +696,7 @@ namespace { // known attacking/defending status of the players. template - Score Evaluation::initiative(Score score, Score materialScore) const { + Score Evaluation::initiative(Score score) const { int outflanking = distance(pos.square(WHITE), pos.square(BLACK)) - distance(pos.square(WHITE), pos.square(BLACK)); @@ -722,7 +722,7 @@ namespace { - 100 ; // Give more importance to non-material score - score = (score * 2 - materialScore) / 2; + score = score - pos.psq_score() / 2; Value mg = mg_value(score); Value eg = eg_value(score); @@ -794,9 +794,6 @@ namespace { if (abs(v) > LazyThreshold + pos.non_pawn_material() / 64) return pos.side_to_move() == WHITE ? v : -v; - // Remember this score - Score materialScore = score; - // Main evaluation begins here initialize(); @@ -815,7 +812,7 @@ namespace { + passed< WHITE>() - passed< BLACK>() + space< WHITE>() - space< BLACK>(); - score += initiative(score, materialScore); + score += initiative(score); // Interpolate between a middlegame and a (scaled by 'sf') endgame score ScaleFactor sf = scale_factor(eg_value(score)); -- 2.39.2