]> git.sesse.net Git - stockfish/commitdiff
Use score instead of array to evaluate shelter
authorprotonspring <mike@whiteley.org>
Tue, 9 Jul 2019 20:03:00 +0000 (14:03 -0600)
committerStéphane Nicolet <cassio@free.fr>
Thu, 11 Jul 2019 09:42:08 +0000 (11:42 +0200)
This is a non-functional simplification. Instead of an array of values, just use a Score.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16309 W: 3673 L: 3541 D: 9095
http://tests.stockfishchess.org/tests/view/5d24f3b80ebc5925cf0ceb5b

No functional change

src/pawns.cpp
src/search.cpp

index c85d4fd942b907cd6de1b0241c1bb49a763d57da..acc3d77096dd10f79742c4be15e69d2baa76fa9c 100644 (file)
@@ -181,13 +181,13 @@ Entry* probe(const Position& pos) {
 template<Color Us>
 void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) {
 
 template<Color Us>
 void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) {
 
-  constexpr Color     Them = (Us == WHITE ? BLACK : WHITE);
+  constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
 
   Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq);
   Bitboard ourPawns = b & pos.pieces(Us);
   Bitboard theirPawns = b & pos.pieces(Them);
 
 
   Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq);
   Bitboard ourPawns = b & pos.pieces(Us);
   Bitboard theirPawns = b & pos.pieces(Them);
 
-  Value bonus[] = { Value(5), Value(5) };
+  Score bonus = make_score(5, 5);
 
   File center = clamp(file_of(ksq), FILE_B, FILE_G);
   for (File f = File(center - 1); f <= File(center + 1); ++f)
 
   File center = clamp(file_of(ksq), FILE_B, FILE_G);
   for (File f = File(center - 1); f <= File(center + 1); ++f)
@@ -199,16 +199,16 @@ void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) {
       Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
 
       int d = std::min(f, ~f);
       Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
 
       int d = std::min(f, ~f);
-      bonus[MG] += ShelterStrength[d][ourRank];
+      bonus += make_score(ShelterStrength[d][ourRank], 0);
 
       if (ourRank && (ourRank == theirRank - 1))
 
       if (ourRank && (ourRank == theirRank - 1))
-          bonus[MG] -= 82 * (theirRank == RANK_3), bonus[EG] -= 82 * (theirRank == RANK_3);
+          bonus -= make_score(82 * (theirRank == RANK_3), 82 * (theirRank == RANK_3));
       else
       else
-          bonus[MG] -= UnblockedStorm[d][theirRank];
+          bonus -= make_score(UnblockedStorm[d][theirRank], 0);
   }
 
   }
 
-  if (bonus[MG] > mg_value(shelter))
-      shelter = make_score(bonus[MG], bonus[EG]);
+  if (mg_value(bonus) > mg_value(shelter))
+      shelter = bonus;
 }
 
 
 }
 
 
index b4a69092ccedc1489c53ae7c064ec99b46e9e157..8993a4b05fbf3069c8f55e092cfa4d27ee6b8dc5 100644 (file)
@@ -1070,7 +1070,7 @@ moves_loop: // When in check, search starts from here
           Depth r = reduction(improving, depth, moveCount);
 
           // Reduction if other threads are searching this position.
           Depth r = reduction(improving, depth, moveCount);
 
           // Reduction if other threads are searching this position.
-         if (th.marked())
+          if (th.marked())
               r += ONE_PLY;
 
           // Decrease reduction if position is or has been on the PV
               r += ONE_PLY;
 
           // Decrease reduction if position is or has been on the PV