]> git.sesse.net Git - stockfish/commitdiff
MovePicker doesn't need to know if called from a pv node
authorMarco Costalba <mcostalba@gmail.com>
Thu, 11 Jun 2009 09:04:05 +0000 (11:04 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 12 Jun 2009 11:10:02 +0000 (13:10 +0200)
This was needed by an old optimization in sorting of
non-captures that is now obsoleted by new std::sort()
approach.

Remove also the unused depth member data. Interestingly
this has always been unused since the Glaurung days.

No functional change.

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

index 7906eb7535631c2bcb8ea6c5398eb82d8e37ed02..4b08e1b46d35c07e95bd65cf547e459f1bdbe86e 100644 (file)
@@ -63,10 +63,8 @@ namespace {
 /// search captures, promotions and some checks) and about how important good
 /// move ordering is at the current node.
 
-MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
+MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
                        const History& h, SearchStack* ss) : pos(p), H(h) {
-
-  pvNode = pv;
   ttMove = ttm;
   if (ss)
   {
@@ -76,17 +74,14 @@ MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
   } else
       mateKiller = killer1 = killer2 = MOVE_NONE;
 
-  depth = d;
-  movesPicked = 0;
-  numOfMoves = 0;
-  numOfBadCaptures = 0;
-  checkKillers = checkLegal = false;
+  movesPicked = numOfMoves = numOfBadCaptures = 0;
+  checkKillers = checkLegal = finished = false;
 
   if (p.is_check())
       phaseIndex = EvasionsPhaseIndex;
-  else if (depth > Depth(0))
+  else if (d > Depth(0))
       phaseIndex = MainSearchPhaseIndex;
-  else if (depth == Depth(0))
+  else if (d == Depth(0))
       phaseIndex = QsearchWithChecksPhaseIndex;
   else
       phaseIndex = QsearchWithoutChecksPhaseIndex;
index 94a0e5f9548afb864361ae826f2cef914703a302..bcd5eb14e1b57cb77d92d81cd3bd5a8640920bb8 100644 (file)
@@ -65,7 +65,7 @@ public:
     PH_STOP
   };
 
-  MovePicker(const Position& p, bool pvnode, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
+  MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
   Move get_next_move();
   Move get_next_move(Lock& lock);
   int number_of_moves() const;
@@ -85,8 +85,6 @@ private:
   Move ttMove, mateKiller, killer1, killer2;
   Bitboard pinned, dc;
   MoveStack moves[256], badCaptures[64];
-  bool pvNode;
-  Depth depth;
   int phaseIndex;
   int numOfMoves, numOfBadCaptures;
   int movesPicked;
index fad47f9573a0d63b66b94b32b00c1aa0fcccf39b..b53b2013d009a5ee81fc469f1889ca6ac8135e8e 100644 (file)
@@ -141,7 +141,7 @@ Move move_from_san(const Position& pos, const string& movestr) {
 
   assert(pos.is_ok());
 
-  MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H);
+  MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H);
 
   // Castling moves
   if (movestr == "O-O-O" || movestr == "O-O-O+")
@@ -365,7 +365,7 @@ namespace {
     if (type_of_piece(pc) == KING)
         return AMBIGUITY_NONE;
 
-    MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H);
+    MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H);
     Move mv, moveList[8];
 
     int n = 0;
index a6e2c3410d504bf3d9f3de04abb0ba3249b59e65..8021f0f57ed7e333fd213939ca12134756bef7bf 100644 (file)
@@ -1054,7 +1054,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves
-    MovePicker mp = MovePicker(pos, true, ttMove, depth, Threads[threadID].H, &ss[ply]);
+    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1315,7 +1315,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves:
-    MovePicker mp = MovePicker(pos, false, ttMove, depth, Threads[threadID].H, &ss[ply]);
+    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1535,7 +1535,7 @@ namespace {
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
-    MovePicker mp = MovePicker(pos, pvNode, ttMove, depth, Threads[threadID].H);
+    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H);
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();