]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Fix MultiPv and Skill in SMP.
[stockfish] / src / search.cpp
index 13fb4b300936492657ee375d0d14c3e9bf460e46..3c34f185c35eda640b5022851eccdf65631a588a 100644 (file)
@@ -290,12 +290,11 @@ void MainThread::search() {
       {
           th->maxPly = 0;
           th->rootDepth = DEPTH_ZERO;
-          th->searching = true;
           if (th != this)
           {
               th->rootPos = Position(rootPos, th);
               th->rootMoves = rootMoves;
-              th->notify_one(); // Wake up the thread and start searching
+              th->start_searching();
           }
       }
 
@@ -324,14 +323,15 @@ void MainThread::search() {
   // Wait until all threads have finished
   for (Thread* th : Threads)
       if (th != this)
-          th->join();
+          th->wait_for_search_finished();
 
   // Check if there are threads with a better score than main thread.
   Thread* bestThread = this;
-  for (Thread* th : Threads)
-      if (   th->completedDepth > bestThread->completedDepth
-          && th->rootMoves[0].score > bestThread->rootMoves[0].score)
-        bestThread = th;
+  if (Options["MultiPV"] == 1 && !Skill(Options["Skill Level"]).enabled())
+      for (Thread* th : Threads)
+          if (   th->completedDepth > bestThread->completedDepth
+              && th->rootMoves[0].score > bestThread->rootMoves[0].score)
+            bestThread = th;
 
   // Send new PV when needed.
   // FIXME: Breaks multiPV, and skill levels
@@ -921,7 +921,8 @@ moves_loop: // When in check search starts from here
               continue;
 
           // History based pruning
-          if (   depth <= 3 * ONE_PLY
+          if (   depth <= 4 * ONE_PLY
+              && move != ss->killers[0]
               && thisThread->history[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO
               && cmh[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO)
               continue;