]> git.sesse.net Git - stockfish/commitdiff
Update correction history in case of successful null move pruning
authorMichael Chaly <Vizvezdenec@gmail.com>
Mon, 20 May 2024 00:22:40 +0000 (03:22 +0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 21 May 2024 06:17:20 +0000 (08:17 +0200)
Since null move pruning uses the same position it makes some sense to try to update correction history there in case of fail high.
Update value is 4 times less than normal update.

Passed STC:
https://tests.stockfishchess.org/tests/view/664a011cae57c1758ac5b4dd
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 419360 W: 108390 L: 107505 D: 203465
Ptnml(0-2): 1416, 49603, 106724, 50554, 1383

Passed LTC:
https://tests.stockfishchess.org/tests/view/664a53d95fc7b70b8817c65b
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 193518 W: 49076 L: 48434 D: 96008
Ptnml(0-2): 89, 21335, 53263, 21989, 83

closes https://github.com/official-stockfish/Stockfish/pull/5272

bench 1301487

src/nnue/nnue_misc.cpp
src/search.cpp

index b54bbaba3ddbbdd9c3900415290cc03a224a9395..a13c717c3d80990a5af55523543f7016063eb8e8 100644 (file)
@@ -178,11 +178,14 @@ trace(Position& pos, const Eval::NNUE::Networks& networks, Eval::NNUE::Accumulat
         ss << "|  " << bucket << "        ";
         ss << " |  ";
         format_cp_aligned_dot(t.psqt[bucket], ss, pos);
-        ss << "  " << " |  ";
+        ss << "  "
+           << " |  ";
         format_cp_aligned_dot(t.positional[bucket], ss, pos);
-        ss << "  " << " |  ";
+        ss << "  "
+           << " |  ";
         format_cp_aligned_dot(t.psqt[bucket] + t.positional[bucket], ss, pos);
-        ss << "  " << " |";
+        ss << "  "
+           << " |";
         if (bucket == t.correctBucket)
             ss << " <-- this bucket is used";
         ss << '\n';
index 7e95dd878c31f16feb68c40e38e56a0a4ed26c47..2ed5d97bb5d5f2fb99004f2ef3d5ce15418ba6d1 100644 (file)
@@ -802,7 +802,16 @@ Value Search::Worker::search(
         if (nullValue >= beta && nullValue < VALUE_TB_WIN_IN_MAX_PLY)
         {
             if (thisThread->nmpMinPly || depth < 16)
+            {
+                if (nullValue >= ss->staticEval)
+                {
+                    auto bonus = std::min(int(nullValue - ss->staticEval) * depth / 32,
+                                          CORRECTION_HISTORY_LIMIT / 16);
+                    thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)]
+                      << bonus;
+                }
                 return nullValue;
+            }
 
             assert(!thisThread->nmpMinPly);  // Recursive verification is not allowed