]> git.sesse.net Git - stockfish/commitdiff
Small cleanups 13
authorStéphane Nicolet <cassio@free.fr>
Thu, 12 Nov 2020 13:05:28 +0000 (14:05 +0100)
committerStéphane Nicolet <cassio@free.fr>
Mon, 23 Nov 2020 21:20:32 +0000 (22:20 +0100)
No functional change

AUTHORS
src/evaluate.cpp
src/misc.cpp
src/nnue/nnue_feature_transformer.h
src/pawns.cpp
src/search.cpp
src/types.h

diff --git a/AUTHORS b/AUTHORS
index f30be4de107d12794d851ca97b0dc563d3240d2c..71b718b80de1839791464233cd634a15ab248486 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -44,6 +44,7 @@ Daniel Dugovic (ddugovic)
 Dariusz Orzechowski (dorzechowski)
 David Zar
 Daylen Yang (daylen)
+Deshawn Mohan-Smith (GoldenRare)
 DiscanX
 Dominik Schlösser (domschl)
 double-beep
@@ -64,7 +65,6 @@ Gary Heckman (gheckman)
 George Sobala (gsobala)
 gguliash
 Gian-Carlo Pascutto (gcp)
-Deshawn Mohan-Smith (GoldenRare)
 Gontran Lemaire (gonlem)
 Goodkov Vasiliy Aleksandrovich (goodkov)
 Gregor Cramer
index 34ebe6c3febbac4ac02771bdeef28424a2245fad..1a8cf662c6f46caa494a27bfaf84f8d24362b86f 100644 (file)
@@ -1025,7 +1025,7 @@ Value Eval::evaluate(const Position& pos) {
   {
       // Scale and shift NNUE for compatibility with search and classical evaluation
       auto  adjusted_NNUE = [&](){
-         int mat = pos.non_pawn_material() + PieceValue[MG][PAWN] * pos.count<PAWN>();
+         int mat = pos.non_pawn_material() + PawnValueMg * pos.count<PAWN>();
          return NNUE::evaluate(pos) * (720 + mat / 32) / 1024 + Tempo;
       };
 
@@ -1041,10 +1041,10 @@ Value Eval::evaluate(const Position& pos) {
       // For the case of opposite colored bishops, switch to NNUE eval with
       // small probability if the classical eval is less than the threshold.
       if (   largePsq
-          && (abs(v) * 16 < NNUEThreshold2 * r50
-          || (   pos.opposite_bishops()
-              && abs(v) * 16 < (NNUEThreshold1 + pos.non_pawn_material() / 64) * r50
-              && !(pos.this_thread()->nodes & 0xB))))
+          && (   abs(v) * 16 < NNUEThreshold2 * r50
+              || (   pos.opposite_bishops()
+                  && abs(v) * 16 < (NNUEThreshold1 + pos.non_pawn_material() / 64) * r50
+                  && !(pos.this_thread()->nodes & 0xB))))
           v = adjusted_NNUE();
   }
 
index a16a6e90a3daddefe82a7716934d86baf2cac31b..f2bce6b04f934948ccad68863beeb4c74c16b571 100644 (file)
@@ -583,11 +583,10 @@ namespace CommandLine {
 string argv0;            // path+name of the executable binary, as given by argv[0]
 string binaryDirectory;  // path of the executable directory
 string workingDirectory; // path of the working directory
-string pathSeparator;    // Separator for our current OS
 
 void init(int argc, char* argv[]) {
     (void)argc;
-    string separator;
+    string pathSeparator;
 
     // extract the path+name of the executable binary
     argv0 = argv[0];
index f49777b50bbe3f6809acd358399ae9b5dbf1bda1..85bc2bc8e66cb5014cfb779e7f25e3482d1aa8a9 100644 (file)
@@ -247,7 +247,7 @@ namespace Eval::NNUE {
       // Look for a usable accumulator of an earlier position. We keep track
       // of the estimated gain in terms of features to be added/subtracted.
       StateInfo *st = pos.state(), *next = nullptr;
-      int gain = popcount(pos.pieces()) - 2;
+      int gain = pos.count<ALL_PIECES>() - 2;
       while (st->accumulator.state[c] == EMPTY)
       {
         auto& dp = st->dirtyPiece;
index fde70ba5306b6b47bec6d01f597c19fac0ada86c..68aaf331a8b0668bb772495a4ed6430684b0bdec 100644 (file)
@@ -176,8 +176,8 @@ namespace {
             score -=  Doubled * doubled
                     + WeakLever * more_than_one(lever);
 
-        if (blocked && r > RANK_4)
-            score += BlockedPawn[r-4];
+        if (blocked && r >= RANK_5)
+            score += BlockedPawn[r - RANK_5];
     }
 
     return score;
index 66ef5043d28e2280d286509cf2aaee482677e190..78a1f7b6eb9e038a5c24f415dd127a2ddb67c13b 100644 (file)
@@ -1058,7 +1058,7 @@ moves_loop: // When in check, search starts from here
                   && captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] < 0)
                   continue;
 
-              // See based pruning
+              // SEE based pruning
               if (!pos.see_ge(move, Value(-221) * depth)) // (~25 Elo)
                   continue;
           }
index bf692f7e645f68faeb411e8d6479c25d3ede3071..8506b06eab0a1a900f6847d4754ce824940b1eee 100644 (file)
@@ -202,8 +202,8 @@ enum PieceType {
 
 enum Piece {
   NO_PIECE,
-  W_PAWN = 1, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
-  B_PAWN = 9, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING,
+  W_PAWN = PAWN,     W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
+  B_PAWN = PAWN + 8, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING,
   PIECE_NB = 16
 };