]> git.sesse.net Git - stockfish/commitdiff
Small clean-ups
authorStéphane Nicolet <cassio@free.fr>
Mon, 17 May 2021 07:13:34 +0000 (09:13 +0200)
committerStéphane Nicolet <cassio@free.fr>
Mon, 17 May 2021 08:47:14 +0000 (10:47 +0200)
- Comment for Countemove pruning -> Continuation history
- Fix comment in input_slice.h
- Shorter lines in Makefile
- Comment for scale factor
- Fix comment for pinners in see_ge()
- Change Thread.id() signature to size_t
- Trailing space in reprosearch.sh
- Add Douglas Matos Gomes to the AUTHORS file
- Introduce comment for undo_null_move()
- Use Stockfish coding style for export_net()
- Change date in AUTHORS file

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

No functional change

AUTHORS
src/Makefile
src/evaluate.cpp
src/nnue/layers/input_slice.h
src/position.cpp
src/search.cpp
src/thread.h
tests/reprosearch.sh

diff --git a/AUTHORS b/AUTHORS
index 69d682f13f2abb908fb217edc4c2a5df8f699205..9042495fdc0ea839e53b9a5e5eeda2db00329a5c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-# List of authors for Stockfish, as of March 31, 2021
+# List of authors for Stockfish, as of May 17, 2021
 
 # Founders of the Stockfish project and fishtest infrastructure
 Tord Romstad (romstad)
@@ -52,6 +52,7 @@ Dieter Dobbelaere (ddobbelaere)
 DiscanX
 Dominik Schlösser (domschl)
 double-beep
+Douglas Matos Gomes (dsmsgms)
 Eduardo Cáceres (eduherminio)
 Eelco de Groot (KingDefender)
 Elvin Liu (solarlight2)
index 71105bdb65dba4e4cdefd92bc01452339acdeff3..660a13fb6bcaf4f7917b792ebde906b3216336fc 100644 (file)
@@ -96,8 +96,7 @@ endif
 ifeq ($(ARCH), $(filter $(ARCH), \
                  x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
                  x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
-                 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 \
-                 e2k \
+                 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 e2k \
                  armv7 armv7-neon armv8 apple-silicon general-64 general-32))
    SUPPORTED_ARCH=true
 else
@@ -840,8 +839,7 @@ config-sanity: net
        @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
        @test "$(SUPPORTED_ARCH)" = "true"
        @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
-        test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \
-        test "$(arch)" = "e2k" || \
+        test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "e2k" || \
         test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
        @test "$(bits)" = "32" || test "$(bits)" = "64"
        @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
index c396e0f757569bbf1674c3fb44bd2b303b1c40d0..403d59dd70d0cc0deb1b5f6f69433ff784a9ba44 100644 (file)
@@ -114,24 +114,28 @@ namespace Eval {
         }
   }
 
+  /// NNUE::export_net() exports the currently loaded network to a file
   void NNUE::export_net(const std::optional<std::string>& filename) {
     std::string actualFilename;
-    if (filename.has_value()) {
-      actualFilename = filename.value();
-    } else {
-      if (eval_file_loaded != EvalFileDefaultName) {
-        sync_cout << "Failed to export a net. A non-embedded net can only be saved if the filename is specified." << sync_endl;
-        return;
-      }
-      actualFilename = EvalFileDefaultName;
+
+    if (filename.has_value())
+        actualFilename = filename.value();
+    else 
+    {
+        if (eval_file_loaded != EvalFileDefaultName)
+        {
+             sync_cout << "Failed to export a net. A non-embedded net can only be saved if the filename is specified." << sync_endl;
+             return;
+        }
+        actualFilename = EvalFileDefaultName;
     }
 
     ofstream stream(actualFilename, std::ios_base::binary);
-    if (save_eval(stream)) {
+
+    if (save_eval(stream))
         sync_cout << "Network saved successfully to " << actualFilename << "." << sync_endl;
-    } else {
+    else
         sync_cout << "Failed to export a net." << sync_endl;
-    }
   }
 
   /// NNUE::verify() verifies that the last net used was loaded successfully
@@ -927,7 +931,7 @@ namespace {
     Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK;
     int sf = me->scale_factor(pos, strongSide);
 
-    // If scale factor is not already specific, scale down via general heuristics
+    // If scale factor is not already specific, scale up/down via general heuristics
     if (sf == SCALE_FACTOR_NORMAL)
     {
         if (pos.opposite_bishops())
index bd4d74478de6a44cfe2474845705e5f30aa42f71..b6bf1727b406824fe6de7028417393d6f7d45e96 100644 (file)
@@ -53,7 +53,7 @@ class InputSlice {
     return true;
   }
 
-  // Read network parameters
+  // Write network parameters
   bool write_parameters(std::ostream& /*stream*/) const {
     return true;
   }
index 2b3be3f7767c267937514e18ed9ce46b92ee7b17..f1c36156a3b08551393f829ddcf43aad872af91c 100644 (file)
@@ -988,7 +988,7 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ
 }
 
 
-/// Position::do(undo)_null_move() is used to do(undo) a "null move": it flips
+/// Position::do_null_move() is used to do a "null move": it flips
 /// the side to move without executing any move on the board.
 
 void Position::do_null_move(StateInfo& newSt) {
@@ -1027,6 +1027,9 @@ void Position::do_null_move(StateInfo& newSt) {
   assert(pos_is_ok());
 }
 
+
+/// Position::undo_null_move() must be used to undo a "null move"
+
 void Position::undo_null_move() {
 
   assert(!checkers());
@@ -1092,8 +1095,8 @@ bool Position::see_ge(Move m, Value threshold) const {
       if (!(stmAttackers = attackers & pieces(stm)))
           break;
 
-      // Don't allow pinned pieces to attack (except the king) as long as
-      // there are pinners on their original square.
+      // Don't allow pinned pieces to attack as long as there are
+      // pinners on their original square.
       if (pinners(~stm) & occupied)
           stmAttackers &= ~blockers_for_king(stm);
 
index bf6ba6c4cd6589f48865570f11a85ff93b891805..29b334ed5fb535f81fd655eee0ef253eb32d4c1e 100644 (file)
@@ -862,7 +862,6 @@ namespace {
              && ttValue != VALUE_NONE
              && ttValue < probCutBeta))
     {
-
         assert(probCutBeta < VALUE_INFINITE);
 
         MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, &captureHistory);
@@ -1025,7 +1024,7 @@ moves_loop: // When in check, search starts from here
           }
           else
           {
-              // Countermoves based pruning (~20 Elo)
+              // Continuation history based pruning (~20 Elo)
               if (   lmrDepth < 4
                   && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
                   && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
@@ -1528,7 +1527,7 @@ moves_loop: // When in check, search starts from here
                                                                 [pos.moved_piece(move)]
                                                                 [to_sq(move)];
 
-      // CounterMove based pruning
+      // Continuation history based pruning
       if (  !captureOrPromotion
           && bestValue > VALUE_TB_LOSS_IN_MAX_PLY
           && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold
index 4cf5dabb5b1fb44cee51c1a51333448f25e2b8d8..5785fd25eb7ab28eaa972c32fe9b51fb80a7758b 100644 (file)
@@ -55,7 +55,7 @@ public:
   void idle_loop();
   void start_searching();
   void wait_for_search_finished();
-  int id() const { return idx; }
+  size_t id() const { return idx; }
 
   Pawns::Table pawnsTable;
   Material::Table materialTable;
index 9fd847ff3a9c0a6dc72c50e0f4b2c3a92dc33b2a..c1167f7f169441b6dedf14fcec8e4879f70a2839 100755 (executable)
@@ -10,7 +10,7 @@ trap 'error ${LINENO}' ERR
 
 echo "reprosearch testing started"
 
-# repeat two short games, separated by ucinewgame. 
+# repeat two short games, separated by ucinewgame.
 # with go nodes $nodes they should result in exactly
 # the same node count for each iteration.
 cat << EOF > repeat.exp