]> git.sesse.net Git - stockfish/commitdiff
Provide selective search depth info for each pv move
authorjoergoster <osterj165@googlemail.com>
Thu, 13 Jul 2017 23:30:03 +0000 (16:30 -0700)
committerJoona Kiiski <joona@zoox.com>
Thu, 13 Jul 2017 23:30:03 +0000 (16:30 -0700)
No functional change

Closes #1166

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

index 1c000b5bad78a8d847d5f4d8c3ecfe130dff2e48..4551c39d4402eaa995c9a5ebeab8ffdb47e88a06 100644 (file)
@@ -383,6 +383,9 @@ void Thread::search() {
       // MultiPV loop. We perform a full root search for each PV line
       for (PVIdx = 0; PVIdx < multiPV && !Threads.stop; ++PVIdx)
       {
+          // Reset UCI info selDepth for each depth and each PV line
+          selDepth = 0;
+
           // Reset aspiration window starting size
           if (rootDepth >= 5 * ONE_PLY)
           {
@@ -566,8 +569,8 @@ namespace {
         static_cast<MainThread*>(thisThread)->check_time();
 
     // Used to send selDepth info to GUI
-    if (PvNode && thisThread->maxPly < ss->ply)
-        thisThread->maxPly = ss->ply;
+    if (PvNode && thisThread->selDepth < ss->ply)
+        thisThread->selDepth = ss->ply;
 
     if (!rootNode)
     {
@@ -1043,6 +1046,7 @@ moves_loop: // When in check search starts from here
           if (moveCount == 1 || value > alpha)
           {
               rm.score = value;
+              rm.selDepth = thisThread->selDepth;
               rm.pv.resize(1);
 
               assert((ss+1)->pv);
@@ -1525,7 +1529,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) {
 
       ss << "info"
          << " depth "    << d / ONE_PLY
-         << " seldepth " << pos.this_thread()->maxPly
+         << " seldepth " << rootMoves[i].selDepth
          << " multipv "  << i + 1
          << " score "    << UCI::value(v);
 
index 7c46980b2d36f07808e1f7acd8b02fbdb46062ac..a2a02edac3ed2c63217808aee07c23b459a4abab 100644 (file)
@@ -64,6 +64,7 @@ struct RootMove {
 
   Value score = -VALUE_INFINITE;
   Value previousScore = -VALUE_INFINITE;
+  int selDepth = 0;
   std::vector<Move> pv;
 };
 
index 66f74b997342c0db87304f29ab5eb1c58983119c..86fce6aa0c20020b6c54666c874a5231793d6c9e 100644 (file)
@@ -35,7 +35,7 @@ ThreadPool Threads; // Global object
 Thread::Thread() {
 
   exit = false;
-  maxPly = 0;
+  selDepth = 0;
   nodes = tbHits = 0;
   idx = Threads.size(); // Start from 0
 
@@ -210,7 +210,6 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states,
 
   for (Thread* th : Threads)
   {
-      th->maxPly = 0;
       th->nodes = 0;
       th->tbHits = 0;
       th->rootDepth = DEPTH_ZERO;
index 77517b07fe85aeb2212bd048a7c792c12c6a32eb..35cf3efeb53aea704394f20a11bf36d86c815561 100644 (file)
@@ -60,7 +60,7 @@ public:
   Material::Table materialTable;
   Endgames endgames;
   size_t idx, PVIdx;
-  int maxPly;
+  int selDepth;
   std::atomic<uint64_t> nodes, tbHits;
 
   Position rootPos;