]> git.sesse.net Git - stockfish/commitdiff
Remove `previousDepth` in favor of `completedDepth + 2`
authorDubslow <bunslow@gmail.com>
Sun, 15 Jan 2023 10:08:33 +0000 (04:08 -0600)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 28 Jan 2023 15:50:46 +0000 (16:50 +0100)
Beyond the simplification, this could be considered a bugfix from a certain point of view.
However, the effect is very subtle and essentially impossible for users to notice.
5372f81cc8 added about 2 Elo at LTC, but only for second and later `go` commands; now, with
this patch, the first `go` command will also benefit from that gain. Games under time
controls are unaffected (as per the tests).

STC: https://tests.stockfishchess.org/tests/view/63c3d291330c0d3d051d48a8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 473792 W: 124858 L: 125104 D: 223830
Ptnml(0-2): 1338, 49653, 135063, 49601, 1241

LTC: https://tests.stockfishchess.org/tests/view/63c8cd56a83c702aac083bc9
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 290728 W: 76926 L: 76978 D: 136824
Ptnml(0-2): 106, 27987, 89221, 27953, 97

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

bench 4208265

src/search.cpp
src/thread.cpp
src/thread.h

index 4b2deaddd49271ef503d1bc5634c0224085475ab..c748f1ff4251424b91fb1b8f8b6db5a87057502b 100644 (file)
@@ -242,9 +242,6 @@ void MainThread::search() {
   bestPreviousScore = bestThread->rootMoves[0].score;
   bestPreviousAverageScore = bestThread->rootMoves[0].averageScore;
 
-  for (Thread* th : Threads)
-    th->previousDepth = bestThread->completedDepth;
-
   // Send again PV info if we have a new best thread
   if (bestThread != this)
       sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth) << sync_endl;
@@ -1053,7 +1050,7 @@ moves_loop: // When in check, search starts here
           // a reduced search on all the other moves but the ttMove and if the
           // result is lower than ttValue minus a margin, then we will extend the ttMove.
           if (   !rootNode
-              &&  depth >= 4 - (thisThread->previousDepth > 24) + 2 * (PvNode && tte->is_pv())
+              &&  depth >= 4 - (thisThread->completedDepth > 22) + 2 * (PvNode && tte->is_pv())
               &&  move == ttMove
               && !excludedMove // Avoid recursive singular search
            /* &&  ttValue != VALUE_NONE Already implicit in the next condition */
index ca1a7c852731d11b530b10ccea2d42ea5d5573e6..c680393e27752135aa95ea76943233bc539fb83e 100644 (file)
@@ -60,7 +60,6 @@ void Thread::clear() {
   counterMoves.fill(MOVE_NONE);
   mainHistory.fill(0);
   captureHistory.fill(0);
-  previousDepth = 0;
 
   for (bool inCheck : { false, true })
       for (StatsType c : { NoCaptures, Captures })
index 7566322c54c933ec2ef2ca6369fd13cd4aa8f0c8..46cdb11c36a473999aaf970f9eb11544d858b897 100644 (file)
@@ -69,7 +69,7 @@ public:
   Position rootPos;
   StateInfo rootState;
   Search::RootMoves rootMoves;
-  Depth rootDepth, completedDepth, previousDepth;
+  Depth rootDepth, completedDepth;
   Value rootDelta;
   CounterMoveHistory counterMoves;
   ButterflyHistory mainHistory;