]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Finally remove any occurence of dcCandidates from search.cpp
[stockfish] / src / search.cpp
index d54087b966e35c5ef09a131f48e3932d8657d12e..6e210c0f2f086e219e0f3f217c229cc00c1b6050 100644 (file)
@@ -291,8 +291,7 @@ namespace {
   bool idle_thread_exists(int master);
   bool split(const Position &pos, SearchStack *ss, int ply,
              Value *alpha, Value *beta, Value *bestValue, Depth depth,
-             int *moves, MovePicker *mp, Bitboard dcCandidates, int master,
-             bool pvNode);
+             int *moves, MovePicker *mp, int master, bool pvNode);
   void wake_sleeping_threads();
 
 #if !defined(_MSC_VER)
@@ -776,7 +775,6 @@ namespace {
 
     Value alpha = -VALUE_INFINITE;
     Value beta = VALUE_INFINITE, value;
-    Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
 
     // Loop through all the moves in the root move list
     for (int i = 0; i <  rml.move_count() && !AbortSearch; i++)
@@ -809,7 +807,7 @@ namespace {
         newDepth = (Iteration - 2) * OnePly + ext + InitialDepth;
 
         // Make the move, and search it
-        pos.do_move(move, u, dcCandidates);
+        pos.do_move(move, u);
 
         if (i < MultiPV)
         {
@@ -983,9 +981,9 @@ namespace {
     Move move, movesSearched[256];
     int moveCount = 0;
     Value value, bestValue = -VALUE_INFINITE;
-    Bitboard dcCandidates = mp.discovered_check_candidates();
+    Color us = pos.side_to_move();
     bool isCheck = pos.is_check();
-    bool mateThreat = pos.has_mate_threat(opposite_color(pos.side_to_move()));
+    bool mateThreat = pos.has_mate_threat(opposite_color(us));
 
     // Loop through all legal moves until no moves remain or a beta cutoff
     // occurs.
@@ -1014,7 +1012,7 @@ namespace {
 
       // Make and search the move
       UndoInfo u;
-      pos.do_move(move, u, dcCandidates);
+      pos.do_move(move, u);
 
       if (moveCount == 1) // The first move in list is the PV
           value = -search_pv(pos, ss, -beta, -alpha, newDepth, ply+1, threadID);
@@ -1089,7 +1087,7 @@ namespace {
           && !AbortSearch
           && !thread_should_stop(threadID)
           && split(pos, ss, ply, &alpha, &beta, &bestValue, depth,
-                   &moveCount, &mp, dcCandidates, threadID, true))
+                   &moveCount, &mp, threadID, true))
           break;
     }
 
@@ -1283,7 +1281,6 @@ namespace {
     Move move, movesSearched[256];
     int moveCount = 0;
     Value value, bestValue = -VALUE_INFINITE;
-    Bitboard dcCandidates = mp.discovered_check_candidates();
     Value futilityValue = VALUE_NONE;
     bool useFutilityPruning =   UseFutilityPruning
                              && depth < SelectiveDepth
@@ -1338,7 +1335,7 @@ namespace {
 
       // Make and search the move
       UndoInfo u;
-      pos.do_move(move, u, dcCandidates);
+      pos.do_move(move, u);
 
       // Try to reduce non-pv search depth by one ply if move seems not problematic,
       // if the move fails high will be re-searched at full depth.
@@ -1385,7 +1382,7 @@ namespace {
           && !AbortSearch
           && !thread_should_stop(threadID)
           && split(pos, ss, ply, &beta, &beta, &bestValue, depth, &moveCount,
-                   &mp, dcCandidates, threadID, false))
+                   &mp, threadID, false))
         break;
     }
 
@@ -1470,8 +1467,8 @@ namespace {
     MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, isCheck ? NULL : &ei);
     Move move;
     int moveCount = 0;
-    Bitboard dcCandidates = mp.discovered_check_candidates();
-    bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
+    Color us = pos.side_to_move();
+    bool enoughMaterial = pos.non_pawn_material(us) > RookValueMidgame;
 
     // Loop through the moves until no moves remain or a beta cutoff
     // occurs.
@@ -1517,7 +1514,7 @@ namespace {
 
       // Make and search the move.
       UndoInfo u;
-      pos.do_move(move, u, dcCandidates);
+      pos.do_move(move, u);
       Value value = -qsearch(pos, ss, -beta, -alpha, depth-OnePly, ply+1, threadID);
       pos.undo_move(move, u);
 
@@ -1583,7 +1580,6 @@ namespace {
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
       assert(move_is_ok(move));
-      assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
 
       bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
@@ -1610,7 +1606,7 @@ namespace {
 
       // Make and search the move.
       UndoInfo u;
-      pos.do_move(move, u, sp->dcCandidates);
+      pos.do_move(move, u);
 
       // Try to reduce non-pv search depth by one ply if move seems not problematic,
       // if the move fails high will be re-searched at full depth.
@@ -1695,8 +1691,6 @@ namespace {
            && !thread_should_stop(threadID)
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
-      assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
-
       bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
 
@@ -1721,7 +1715,7 @@ namespace {
 
       // Make and search the move.
       UndoInfo u;
-      pos.do_move(move, u, sp->dcCandidates);
+      pos.do_move(move, u);
 
       // Try to reduce non-pv search depth by one ply if move seems not problematic,
       // if the move fails high will be re-searched at full depth.
@@ -2678,8 +2672,7 @@ namespace {
 
   bool split(const Position &p, SearchStack *sstck, int ply,
              Value *alpha, Value *beta, Value *bestValue,
-             Depth depth, int *moves,
-             MovePicker *mp, Bitboard dcCandidates, int master, bool pvNode) {
+             Depth depth, int *moves, MovePicker *mp, int master, bool pvNode) {
     assert(p.is_ok());
     assert(sstck != NULL);
     assert(ply >= 0 && ply < PLY_MAX);
@@ -2715,7 +2708,6 @@ namespace {
     splitPoint->alpha = pvNode? *alpha : (*beta - 1);
     splitPoint->beta = *beta;
     splitPoint->pvNode = pvNode;
-    splitPoint->dcCandidates = dcCandidates;
     splitPoint->bestValue = *bestValue;
     splitPoint->master = master;
     splitPoint->mp = mp;