]> git.sesse.net Git - stockfish/commitdiff
Reduce countermoves less in LMR
authorMarco Costalba <mcostalba@gmail.com>
Sun, 19 May 2013 19:32:52 +0000 (21:32 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 19 May 2013 19:36:23 +0000 (21:36 +0200)
Passed SPRT for both short TC 15+0.05:
LLR: 2.95 (-2.94,2.94)
Total: 17724 W: 3756 L: 3598 D: 10370

And long TC 60+0.05:
LLR: 2.95 (-2.94,2.94)
Total: 22672 W: 4232 L: 4011 D: 14429

bench: 4418832

src/movepick.cpp
src/movepick.h
src/search.cpp

index a729873677d9385f18159b93aebf45c9b7272e1c..2e44994571009ed0bb8d6c4dbf3c4b5a28ecd738 100644 (file)
@@ -70,7 +70,7 @@ namespace {
 /// search captures, promotions and some checks) and about how important good
 /// move ordering is at the current node.
 
 /// search captures, promotions and some checks) and about how important good
 /// move ordering is at the current node.
 
-MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CountermovesStats& cm,
+MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, Move* cm,
                        Search::Stack* s, Value beta) : pos(p), history(h), depth(d) {
 
   assert(d > DEPTH_ZERO);
                        Search::Stack* s, Value beta) : pos(p), history(h), depth(d) {
 
   assert(d > DEPTH_ZERO);
@@ -89,9 +89,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
 
       killers[0].move = ss->killers[0];
       killers[1].move = ss->killers[1];
 
       killers[0].move = ss->killers[0];
       killers[1].move = ss->killers[1];
-      Square prevSq = to_sq((ss-1)->currentMove);
-      killers[2].move = cm[pos.piece_on(prevSq)][prevSq].first;
-      killers[3].move = cm[pos.piece_on(prevSq)][prevSq].second;
+      killers[2].move = cm[0];
+      killers[3].move = cm[1];
 
       // Consider sligtly negative captures as good if at low depth and far from beta
       if (ss && ss->staticEval < beta - PawnValueMg && d < 3 * ONE_PLY)
 
       // Consider sligtly negative captures as good if at low depth and far from beta
       if (ss && ss->staticEval < beta - PawnValueMg && d < 3 * ONE_PLY)
index 8997c93872c46766bf137f1d4cc73cd46194f1a9..5fbaa688631f9e97864820e6254648179c0cbe08 100644 (file)
@@ -86,8 +86,7 @@ class MovePicker {
 public:
   MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
   MovePicker(const Position&, Move, const HistoryStats&, PieceType);
 public:
   MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
   MovePicker(const Position&, Move, const HistoryStats&, PieceType);
-  MovePicker(const Position&, Move, Depth, const HistoryStats&,
-             const CountermovesStats&, Search::Stack*, Value);
+  MovePicker(const Position&, Move, Depth, const HistoryStats&, Move*, Search::Stack*, Value);
 
   template<bool SpNode> Move next_move();
 
 
   template<bool SpNode> Move next_move();
 
index a7c169ac1af1832945c8100e99c2d44bfe6fca3b..a932cf32e37a7e54d4bb4fdd5fc8b9f61c1ceb26 100644 (file)
@@ -766,7 +766,11 @@ namespace {
 
 split_point_start: // At split points actual search starts from here
 
 
 split_point_start: // At split points actual search starts from here
 
-    MovePicker mp(pos, ttMove, depth, History, Countermoves, ss, PvNode ? -VALUE_INFINITE : beta);
+    Square prevMoveSq = to_sq((ss-1)->currentMove);
+    Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first,
+                            Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second };
+
+    MovePicker mp(pos, ttMove, depth, History, countermoves, ss, PvNode ? -VALUE_INFINITE : beta);
     CheckInfo ci(pos);
     value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
     singularExtensionNode =   !RootNode
     CheckInfo ci(pos);
     value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
     singularExtensionNode =   !RootNode
@@ -942,6 +946,9 @@ split_point_start: // At split points actual search starts from here
           &&  move != ss->killers[1])
       {
           ss->reduction = reduction<PvNode>(depth, moveCount);
           &&  move != ss->killers[1])
       {
           ss->reduction = reduction<PvNode>(depth, moveCount);
+          if (move == countermoves[0] || move == countermoves[1])
+              ss->reduction = std::max(DEPTH_ZERO, ss->reduction-ONE_PLY);
+
           Depth d = std::max(newDepth - ss->reduction, ONE_PLY);
           if (SpNode)
               alpha = splitPoint->alpha;
           Depth d = std::max(newDepth - ss->reduction, ONE_PLY);
           if (SpNode)
               alpha = splitPoint->alpha;
@@ -1093,10 +1100,7 @@ split_point_start: // At split points actual search starts from here
             Value bonus = Value(int(depth) * int(depth));
             History.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus);
             if (is_ok((ss-1)->currentMove))
             Value bonus = Value(int(depth) * int(depth));
             History.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus);
             if (is_ok((ss-1)->currentMove))
-            {
-                Square prevSq = to_sq((ss-1)->currentMove);
-                Countermoves.update(pos.piece_on(prevSq), prevSq, bestMove);
-            }
+                Countermoves.update(pos.piece_on(prevMoveSq), prevMoveSq, bestMove);
 
             // Decrease history of all the other played non-capture moves
             for (int i = 0; i < playedMoveCount - 1; i++)
 
             // Decrease history of all the other played non-capture moves
             for (int i = 0; i < playedMoveCount - 1; i++)