]> git.sesse.net Git - stockfish/commitdiff
Use complexity in search
authorRui Coelho <ruicoelhopedro@gmail.com>
Thu, 13 Jan 2022 18:30:53 +0000 (18:30 +0000)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Thu, 13 Jan 2022 21:25:01 +0000 (22:25 +0100)
This patch uses the complexity measure (from #3875) as a heuristic for null move pruning.
Hopefully, there may be room to use it in other pruning techniques.
I would like to thank vondele and locutus2 for the feedback and suggestions during testing.

Passed STC
LLR: 2.95 (-2.94,2.94) <0.00,2.50>
Total: 35000 W: 9624 L: 9347 D: 16029
Ptnml(0-2): 156, 3894, 9137, 4143, 170
https://tests.stockfishchess.org/tests/view/61dda784c65bf87d6c45ab80

Passed LTC
LLR: 2.94 (-2.94,2.94) <0.50,3.00>
Total: 230776 W: 64227 L: 63454 D: 103095
Ptnml(0-2): 1082, 23100, 66380, 23615, 1211
https://tests.stockfishchess.org/tests/view/61ddd0cf3ddbc32543e72c2b

Closes https://github.com/official-stockfish/Stockfish/pull/3890

Bench: 4464962

AUTHORS
src/search.cpp

diff --git a/AUTHORS b/AUTHORS
index d7e6dc986638461ef3dce2a81f00e3ffddea371c..f49c1db0edebbba3f531157c86f75cc9fd185d72 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -166,6 +166,7 @@ Rodrigo Exterckötter Tjäder
 Ron Britvich (Britvich)
 Ronald de Man (syzygy1, syzygy)
 rqs
+Rui Coelho (ruicoelhopedro)
 Ryan Schmitt
 Ryan Takker
 Sami Kiminki (skiminki)
index 58873c8981f3f5dd007d21823e7125cbe3af5607..c81496d17a35aa6a00374c9ec9be9115ea720c49 100644 (file)
@@ -589,7 +589,7 @@ namespace {
     bool givesCheck, improving, didLMR, priorCapture;
     bool captureOrPromotion, doFullDepthSearch, moveCountPruning, ttCapture;
     Piece movedPiece;
-    int moveCount, captureCount, quietCount, bestMoveCount, improvement;
+    int moveCount, captureCount, quietCount, bestMoveCount, improvement, complexity;
 
     // Step 1. Initialize node
     ss->inCheck        = pos.checkers();
@@ -760,6 +760,7 @@ namespace {
         ss->staticEval = eval = VALUE_NONE;
         improving = false;
         improvement = 0;
+        complexity = 0;
         goto moves_loop;
     }
     else if (ss->ttHit)
@@ -803,6 +804,7 @@ namespace {
                   :                                    200;
 
     improving = improvement > 0;
+    complexity = abs(ss->staticEval - (us == WHITE ? eg_value(pos.psq_score()) : -eg_value(pos.psq_score())));
 
     // Step 7. Futility pruning: child node (~25 Elo).
     // The depth condition is important for mate finding.
@@ -818,7 +820,7 @@ namespace {
         && (ss-1)->statScore < 23767
         &&  eval >= beta
         &&  eval >= ss->staticEval
-        &&  ss->staticEval >= beta - 20 * depth - improvement / 15 + 204
+        &&  ss->staticEval >= beta - 20 * depth - improvement / 15 + 204 + complexity / 25
         && !excludedMove
         &&  pos.non_pawn_material(us)
         && (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor))