]> git.sesse.net Git - stockfish/commitdiff
Another small tweak to skills
authorMarco Costalba <mcostalba@gmail.com>
Sat, 31 Jan 2015 12:22:06 +0000 (13:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 31 Jan 2015 17:24:39 +0000 (18:24 +0100)
No functional change.

src/search.cpp
src/search.h

index c188469146eb074ae85ea6c72cef191fdaa014a2..450df57539ca9349ded64dd855f8f7eae50f22bf 100644 (file)
@@ -199,7 +199,7 @@ void Search::think() {
 
   if (RootMoves.empty())
   {
-      RootMoves.push_back(MOVE_NONE);
+      RootMoves.push_back(RootMove(MOVE_NONE));
       sync_cout << "info depth 0 score "
                 << UCI::value(RootPos.checkers() ? -VALUE_MATE : VALUE_DRAW)
                 << sync_endl;
@@ -1383,15 +1383,13 @@ moves_loop: // When in check and at SpNode search starts from here
     // then we choose the move with the resulting highest score.
     for (size_t i = 0; i < multiPV; ++i)
     {
-        int score = RootMoves[i].score;
-
         // This is our magic formula
-        score += (  weakness * int(RootMoves[0].score - score)
-                  + variance * (rng.rand<unsigned>() % weakness)) / 128;
+        int push = (  weakness * int(RootMoves[0].score - RootMoves[i].score)
+                    + variance * (rng.rand<unsigned>() % weakness)) / 128;
 
-        if (score > maxScore)
+        if (RootMoves[i].score + push > maxScore)
         {
-            maxScore = score;
+            maxScore = RootMoves[i].score + push;
             best = RootMoves[i].pv[0];
         }
     }
@@ -1444,7 +1442,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) {
          << " nps "      << pos.nodes_searched() * 1000 / elapsed;
 
       if (elapsed > 1000) // Earlier makes little sense
-          ss << " hashfull "  << TT.hashfull();
+          ss << " hashfull " << TT.hashfull();
 
       ss << " tbhits "   << TB::Hits
          << " time "     << elapsed
index 32cd1bed0ea714ac114cea16e85c957f504bf124..c7a452086b9e7c9364d2ff4491b5dbfdcf8433de 100644 (file)
@@ -55,15 +55,15 @@ struct Stack {
 
 struct RootMove {
 
-  RootMove(Move m) : score(-VALUE_INFINITE), previousScore(-VALUE_INFINITE), pv(1, m) {}
+  explicit RootMove(Move m) : pv(1, m) {}
 
   bool operator<(const RootMove& m) const { return score > m.score; } // Ascending sort
   bool operator==(const Move& m) const { return pv[0] == m; }
   void insert_pv_in_tt(Position& pos);
   bool extract_ponder_from_tt(Position& pos);
 
-  Value score;
-  Value previousScore;
+  Value score = -VALUE_INFINITE;
+  Value previousScore = -VALUE_INFINITE;
   std::vector<Move> pv;
 };