]> git.sesse.net Git - stockfish/commitdiff
Use refinedValue in ProbCut condition
authorMarco Costalba <mcostalba@gmail.com>
Wed, 8 Jun 2011 17:03:26 +0000 (18:03 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 8 Jun 2011 17:03:26 +0000 (18:03 +0100)
After 12613 games at 20"+0.1 on QUAD
Mod vs Orig 1870 - 1863 - 8880 ELO +0 (+- 3.3)

So no performance change but it is a code semplification
and also is more easy to understand.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movepick.cpp
src/movepick.h
src/position.h
src/search.cpp

index 61e5527f42c61d638132201f0b2f2efd18bc999a..7d759f12691058f255f84784e388a09b4fad6c09 100644 (file)
@@ -110,13 +110,13 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h)
   go_next_phase();
 }
 
   go_next_phase();
 }
 
-MovePicker::MovePicker(const Position& p, Move ttm, const History& h, int parentCapture)
+MovePicker::MovePicker(const Position& p, Move ttm, const History& h, int threshold)
                        : pos(p), H(h) {
 
   assert (!pos.in_check());
 
   // In ProbCut we consider only captures better than parent's move
                        : pos(p), H(h) {
 
   assert (!pos.in_check());
 
   // In ProbCut we consider only captures better than parent's move
-  captureThreshold = parentCapture;
+  captureThreshold = threshold;
   phasePtr = ProbCutTable;
 
   if (   ttm != MOVE_NONE
   phasePtr = ProbCutTable;
 
   if (   ttm != MOVE_NONE
index d0ced0474ffd901e6b34275acf520147001fe506..5e4cf7796f0b2214f509740665f490bd4cfd9518 100644 (file)
@@ -42,7 +42,7 @@ class MovePicker {
 public:
   MovePicker(const Position&, Move, Depth, const History&, SearchStack*, Value);
   MovePicker(const Position&, Move, Depth, const History&);
 public:
   MovePicker(const Position&, Move, Depth, const History&, SearchStack*, Value);
   MovePicker(const Position&, Move, Depth, const History&);
-  MovePicker(const Position&, Move, const History&, int parentCapture);
+  MovePicker(const Position&, Move, const History&, int threshold);
   Move get_next_move();
 
 private:
   Move get_next_move();
 
 private:
index 6c48b54c341676f98a58243a7f42869e2a69e74b..1a7149070f3c0640ab8b87e56a3f5df14140eec3 100644 (file)
@@ -213,7 +213,6 @@ public:
   // Static exchange evaluation
   int see(Move m) const;
   int see_sign(Move m) const;
   // Static exchange evaluation
   int see(Move m) const;
   int see_sign(Move m) const;
-  static int see_value(PieceType pt);
 
   // Accessing hash keys
   Key get_key() const;
 
   // Accessing hash keys
   Key get_key() const;
@@ -467,10 +466,6 @@ inline bool Position::square_is_weak(Square s, Color c) const {
   return !(pieces(PAWN, opposite_color(c)) & attack_span_mask(c, s));
 }
 
   return !(pieces(PAWN, opposite_color(c)) & attack_span_mask(c, s));
 }
 
-inline int Position::see_value(PieceType pt) {
-  return seeValues[pt];
-}
-
 inline Key Position::get_key() const {
   return st->key;
 }
 inline Key Position::get_key() const {
   return st->key;
 }
index ec2b1c9cee1d09ce1637bd9bed7d8b7a2e65ed0a..6e440702c9d69fc4ff26efa8fa982b2a565ecc1f 100644 (file)
@@ -903,9 +903,8 @@ namespace {
     }
 
     // Step 9. ProbCut (is omitted in PV nodes)
     }
 
     // Step 9. ProbCut (is omitted in PV nodes)
-    // If we have a very good capture (i.e. SEE > seeValues[captured_piece_type])
-    // and a reduced search returns a value much above beta, we can (almost) safely
-    // prune the previous move.
+    // If we have a good capture that raises the score well above beta and a reduced
+    // search confirms the score then we can (almost) safely prune the previous move.
     if (   !PvNode
         &&  depth >= RazorDepth + ONE_PLY
         && !inCheck
     if (   !PvNode
         &&  depth >= RazorDepth + ONE_PLY
         && !inCheck
@@ -918,7 +917,7 @@ namespace {
 
         assert(rdepth >= ONE_PLY);
 
 
         assert(rdepth >= ONE_PLY);
 
-        MovePicker mp(pos, ttMove, H, Position::see_value(pos.captured_piece_type()));
+        MovePicker mp(pos, ttMove, H, Max(rbeta - refinedValue, VALUE_ZERO));
         pinned = pos.pinned_pieces(pos.side_to_move());
 
         while ((move = mp.get_next_move()) != MOVE_NONE)
         pinned = pos.pinned_pieces(pos.side_to_move());
 
         while ((move = mp.get_next_move()) != MOVE_NONE)