]> git.sesse.net Git - stockfish/blobdiff - src/movepick.cpp
Convert History table H in a local variable
[stockfish] / src / movepick.cpp
index 60fcbaa53364d1ecadd8363908f3163f3ea1db6d..7906eb7535631c2bcb8ea6c5398eb82d8e37ed02 100644 (file)
@@ -63,13 +63,19 @@ 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,
-                       const SearchStack& ss, Depth d) : pos(p) {
+MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
+                       const History& h, SearchStack* ss) : pos(p), H(h) {
+
   pvNode = pv;
   ttMove = ttm;
-  mateKiller = (ss.mateKiller == ttm)? MOVE_NONE : ss.mateKiller;
-  killer1 = ss.killers[0];
-  killer2 = ss.killers[1];
+  if (ss)
+  {
+      mateKiller = (ss->mateKiller == ttm)? MOVE_NONE : ss->mateKiller;
+      killer1 = ss->killers[0];
+      killer2 = ss->killers[1];
+  } else
+      mateKiller = killer1 = killer2 = MOVE_NONE;
+
   depth = d;
   movesPicked = 0;
   numOfMoves = 0;
@@ -162,7 +168,9 @@ Move MovePicker::get_next_move() {
         break;
 
     case PH_BAD_CAPTURES:
-        // It's probably a good idea to use SEE move ordering here. FIXME
+        // Bad captures SEE value is already calculated by score_captures()
+        // so just sort them to get SEE move ordering.
+        std::sort(badCaptures, badCaptures + numOfBadCaptures);
         movesPicked = 0;
         break;