]> git.sesse.net Git - stockfish/commitdiff
Assorted cleanup of latest commits
authorMarco Costalba <mcostalba@gmail.com>
Sun, 13 Mar 2016 08:35:03 +0000 (09:35 +0100)
committerJoona Kiiski <joona@zoox.com>
Tue, 15 Mar 2016 03:42:44 +0000 (20:42 -0700)
No functional change.

Resolves #601

src/evaluate.cpp
src/movepick.cpp
src/movepick.h
src/pawns.h
src/search.cpp
src/types.h

index c0e94cdacd4caf76b9a9c88f36dcd23aae8f2024..d040143272c43ea6ee31d8f205306574b9f24cd8 100644 (file)
@@ -467,7 +467,7 @@ namespace {
   }
 
 
-  // evaluate_threats() assigns bonuses according to the types of the attacking 
+  // evaluate_threats() assigns bonuses according to the types of the attacking
   // and the attacked pieces.
 
   template<Color Us, bool DoTrace>
@@ -679,12 +679,12 @@ namespace {
   // status of the players.
   Score evaluate_initiative(const Position& pos, int asymmetry, Value eg) {
 
-    int kingDistance =   distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
-                       - distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
+    int kingDistance =  distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
+                      - distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
     int pawns = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
 
     // Compute the initiative bonus for the attacking side
-    int initiative = 8 * (asymmetry + kingDistance) + 12 * pawns - 120;
+    int initiative = 8 * (asymmetry + kingDistance - 15) + 12 * pawns;
 
     // Now apply the bonus: note that we find the attacking side by extracting
     // the sign of the endgame value, and that we carefully cap the bonus so
index 0859d772993200007c960cb8198dfae7ac7cfc26..c52384947a6381008b661b5d70d5c8496ea34f9b 100644 (file)
@@ -68,8 +68,10 @@ namespace {
 /// ordering is at the current node.
 
 MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
-                       const CounterMoveStats& cmh, const CounterMoveStats& fmh, Move cm, Search::Stack* s)
-           : pos(p), history(h), counterMoveHistory(&cmh), followupMoveHistory(&fmh), ss(s), countermove(cm), depth(d) {
+                       const CounterMoveStats& cmh, const CounterMoveStats& fmh,
+                       Move cm, Search::Stack* s)
+           : pos(p), history(h), counterMoveHistory(&cmh),
+             followupMoveHistory(&fmh), ss(s), countermove(cm), depth(d) {
 
   assert(d > DEPTH_ZERO);
 
@@ -80,7 +82,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
 
 MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
                        const HistoryStats& h, Square s)
-           : pos(p), history(h), counterMoveHistory(nullptr), followupMoveHistory(nullptr) {
+           : pos(p), history(h) {
 
   assert(d <= DEPTH_ZERO);
 
@@ -105,7 +107,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
 }
 
 MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, Value th)
-           : pos(p), history(h), counterMoveHistory(nullptr), followupMoveHistory(nullptr), threshold(th) {
+           : pos(p), history(h), threshold(th) {
 
   assert(!pos.checkers());
 
@@ -142,7 +144,7 @@ void MovePicker::score<QUIETS>() {
 
   for (auto& m : *this)
       m.value =  history[pos.moved_piece(m)][to_sq(m)]
-               + (*counterMoveHistory)[pos.moved_piece(m)][to_sq(m)]
+               + (*counterMoveHistory )[pos.moved_piece(m)][to_sq(m)]
                + (*followupMoveHistory)[pos.moved_piece(m)][to_sq(m)];
 }
 
index a7140846ee615756c583d1f703a4fc95718fe978..73fbbddb3475f8b7bfaf52753c840167b34d7078 100644 (file)
@@ -83,9 +83,10 @@ public:
   MovePicker(const MovePicker&) = delete;
   MovePicker& operator=(const MovePicker&) = delete;
 
-  MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
   MovePicker(const Position&, Move, const HistoryStats&, Value);
-  MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMoveStats&, const CounterMoveStats&, Move, Search::Stack*);
+  MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
+  MovePicker(const Position&, Move, Depth, const HistoryStats&,
+             const CounterMoveStats&, const CounterMoveStats&, Move, Search::Stack*);
 
   Move next_move();
 
index d46ff4cdd2272d0bdd48a63c27b338ca244325eb..c2f5fc0d34ba51138df1d575b7eacddfcf712edd 100644 (file)
@@ -53,7 +53,7 @@ struct Entry {
   }
 
   template<Color Us>
-  Score king_safety(const Position& pos, Square ksq)  {
+  Score king_safety(const Position& pos, Square ksq) {
     return  kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us)
           ? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq));
   }
index 39131bd5fc105ed4b98d24e84d1642d65e84688a..dc488c2b8922df283d51ba1c525e452b83cab7e4 100644 (file)
@@ -179,8 +179,6 @@ namespace {
 
 void Search::init() {
 
-  const bool PV=true;
-
   for (int imp = 0; imp <= 1; ++imp)
       for (int d = 1; d < 64; ++d)
           for (int mc = 1; mc < 64; ++mc)
@@ -189,12 +187,12 @@ void Search::init() {
               if (r < 0.80)
                 continue;
 
-              Reductions[!PV][imp][d][mc] = int(std::round(r)) * ONE_PLY;
-              Reductions[PV][imp][d][mc] = std::max(Reductions[!PV][imp][d][mc] - ONE_PLY, DEPTH_ZERO);
-              
+              Reductions[NonPV][imp][d][mc] = int(std::round(r)) * ONE_PLY;
+              Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - ONE_PLY, DEPTH_ZERO);
+
               // Increase reduction for non-PV nodes when eval is not improving
-              if (!imp && Reductions[!PV][imp][d][mc] >= 2 * ONE_PLY)
-                Reductions[!PV][imp][d][mc] += ONE_PLY;
+              if (!imp && Reductions[NonPV][imp][d][mc] >= 2 * ONE_PLY)
+                Reductions[NonPV][imp][d][mc] += ONE_PLY;
           }
 
   for (int d = 0; d < 16; ++d)
@@ -1429,8 +1427,8 @@ moves_loop: // When in check search starts from here
   }
 
 
-  // update_stats() updates killers, history, countermove and countermove
-  // history when a new quiet best move is found.
+  // update_stats() updates killers, history, countermove and countermove plus
+  // follow-up move history when a new quiet best move is found.
 
   void update_stats(const Position& pos, Stack* ss, Move move,
                     Depth depth, Move* quiets, int quietsCnt) {
index 9b7e538d95b2e61609d47b240e16241ca375d2f2..aa015ce5ef9042c7ffa65ad5846bfaabb7d29839 100644 (file)
@@ -355,7 +355,7 @@ inline Piece make_piece(Color c, PieceType pt) {
   return Piece((c << 3) | pt);
 }
 
-inline PieceType type_of(Piece pc)  {
+inline PieceType type_of(Piece pc) {
   return PieceType(pc & 7);
 }