]> git.sesse.net Git - stockfish/commitdiff
Remove failedLow from the mainThread struct
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 11 Jun 2018 07:46:05 +0000 (09:46 +0200)
committerStéphane Nicolet <cassio@free.fr>
Mon, 11 Jun 2018 07:46:26 +0000 (09:46 +0200)
failedLow is in fact a local variable in Thread::search().

Also clean some spaces and tabs in code.

No functional change.

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

index a65f2338d1fee51f3c6301f69d2e383c7e0c6785..6901d7b7845f0a92244ec1e1e2739926948e9d27 100644 (file)
@@ -34,7 +34,7 @@ namespace {
   // Pawn penalties
   constexpr Score Isolated = S(13, 16);
   constexpr Score Backward = S(17, 11);
   // Pawn penalties
   constexpr Score Isolated = S(13, 16);
   constexpr Score Backward = S(17, 11);
-  constexpr Score Doubled = S(13, 40);
+  constexpr Score Doubled  = S(13, 40);
 
   // Connected pawn bonus by opposed, phalanx, #support and rank
   Score Connected[2][2][3][RANK_NB];
 
   // Connected pawn bonus by opposed, phalanx, #support and rank
   Score Connected[2][2][3][RANK_NB];
index 7cc0542ab0cdbb8abeb821593fb2de45816d8209..e1ca7964922610a7691d9b56543e243ce82d0830 100644 (file)
@@ -296,6 +296,7 @@ void Thread::search() {
   MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr);
   double timeReduction = 1.0;
   Color us = rootPos.side_to_move();
   MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr);
   double timeReduction = 1.0;
   Color us = rootPos.side_to_move();
+  bool failedLow;
 
   std::memset(ss-4, 0, 7 * sizeof(Stack));
   for (int i = 4; i > 0; i--)
 
   std::memset(ss-4, 0, 7 * sizeof(Stack));
   for (int i = 4; i > 0; i--)
@@ -305,7 +306,7 @@ void Thread::search() {
   beta = VALUE_INFINITE;
 
   if (mainThread)
   beta = VALUE_INFINITE;
 
   if (mainThread)
-      mainThread->bestMoveChanges = 0, mainThread->failedLow = false;
+      mainThread->bestMoveChanges = 0, failedLow = false;
 
   size_t multiPV = Options["MultiPV"];
   Skill skill(Options["Skill Level"]);
 
   size_t multiPV = Options["MultiPV"];
   Skill skill(Options["Skill Level"]);
@@ -346,7 +347,7 @@ void Thread::search() {
 
       // Age out PV variability metric
       if (mainThread)
 
       // Age out PV variability metric
       if (mainThread)
-          mainThread->bestMoveChanges *= 0.517, mainThread->failedLow = false;
+          mainThread->bestMoveChanges *= 0.517, failedLow = false;
 
       // Save the last iteration's scores before first PV line is searched and
       // all the move scores except the (new) PV are set to -VALUE_INFINITE.
 
       // Save the last iteration's scores before first PV line is searched and
       // all the move scores except the (new) PV are set to -VALUE_INFINITE.
@@ -423,7 +424,7 @@ void Thread::search() {
 
                   if (mainThread)
                   {
 
                   if (mainThread)
                   {
-                      mainThread->failedLow = true;
+                      failedLow = true;
                       Threads.stopOnPonderhit = false;
                   }
               }
                       Threads.stopOnPonderhit = false;
                   }
               }
@@ -471,7 +472,7 @@ void Thread::search() {
           && !Threads.stop
           && !Threads.stopOnPonderhit)
           {
           && !Threads.stop
           && !Threads.stopOnPonderhit)
           {
-              const int F[] = { mainThread->failedLow,
+              const int F[] = { failedLow,
                                 bestValue - mainThread->previousScore };
 
               int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1]));
                                 bestValue - mainThread->previousScore };
 
               int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1]));
@@ -522,7 +523,7 @@ namespace {
     constexpr bool PvNode = NT == PV;
     const bool rootNode = PvNode && ss->ply == 0;
 
     constexpr bool PvNode = NT == PV;
     const bool rootNode = PvNode && ss->ply == 0;
 
-    // Check if we have an upcoming move which draws by repetition, or 
+    // Check if we have an upcoming move which draws by repetition, or
     // if the opponent had an alternative move earlier to this position.
     if (   pos.rule50_count() >= 3
         && alpha < VALUE_DRAW
     // if the opponent had an alternative move earlier to this position.
     if (   pos.rule50_count() >= 3
         && alpha < VALUE_DRAW
@@ -1164,8 +1165,8 @@ moves_loop: // When in check, search starts from here
     {
         // Quiet best move: update move sorting heuristics
         if (!pos.capture_or_promotion(bestMove))
     {
         // Quiet best move: update move sorting heuristics
         if (!pos.capture_or_promotion(bestMove))
-            update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, 
-                                                          stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO)));
+            update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount,
+                               stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO)));
         else
             update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY));
 
         else
             update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY));
 
index 341bb9afe1120d7ebd369f15e12fcaec1616a3d4..f3dba3518de32c4fb4d5fa39350d0d2fffe6face 100644 (file)
@@ -85,7 +85,6 @@ struct MainThread : public Thread {
   void search() override;
   void check_time();
 
   void search() override;
   void check_time();
 
-  bool failedLow;
   double bestMoveChanges, previousTimeReduction;
   Value previousScore;
   int callsCnt;
   double bestMoveChanges, previousTimeReduction;
   Value previousScore;
   int callsCnt;