]> git.sesse.net Git - stockfish/blobdiff - src/movepick.cpp
Use special null move technique in low depth.
[stockfish] / src / movepick.cpp
index f50f16b03b2ac9fbfd5c2f20d875fce22f1067e1..7e338dbf62de586ec2e14fa0346eaab44c36b875 100644 (file)
@@ -44,6 +44,8 @@ namespace {
 
   CACHE_LINE_ALIGNMENT
   const MovegenPhaseT MainSearchPhaseTable[] = { PH_STOP, PH_NULL_MOVE, PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
 
   CACHE_LINE_ALIGNMENT
   const MovegenPhaseT MainSearchPhaseTable[] = { PH_STOP, PH_NULL_MOVE, PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
+  const MovegenPhaseT MainSearchNoNullPhaseTable[] = { PH_STOP, PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
+  const MovegenPhaseT LowSearchPhaseTable[]  = { PH_STOP, PH_TT_MOVES, PH_GOOD_CAPTURES, PH_NULL_MOVE, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
   const MovegenPhaseT EvasionsPhaseTable[] = { PH_STOP, PH_EVASIONS, PH_STOP};
   const MovegenPhaseT QsearchWithChecksPhaseTable[] = { PH_STOP, PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
   const MovegenPhaseT QsearchWithoutChecksPhaseTable[] = { PH_STOP, PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
   const MovegenPhaseT EvasionsPhaseTable[] = { PH_STOP, PH_EVASIONS, PH_STOP};
   const MovegenPhaseT QsearchWithChecksPhaseTable[] = { PH_STOP, PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
   const MovegenPhaseT QsearchWithoutChecksPhaseTable[] = { PH_STOP, PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
@@ -78,8 +80,10 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
 
   if (p.is_check())
       phasePtr = EvasionsPhaseTable;
 
   if (p.is_check())
       phasePtr = EvasionsPhaseTable;
+  else if (d >= Depth(3 * OnePly))
+      phasePtr = useNullMove ? MainSearchPhaseTable : MainSearchNoNullPhaseTable;
   else if (d > Depth(0))
   else if (d > Depth(0))
-      phasePtr = MainSearchPhaseTable;
+      phasePtr = useNullMove ? LowSearchPhaseTable : MainSearchNoNullPhaseTable;
   else if (d == Depth(0))
       phasePtr = QsearchWithChecksPhaseTable;
   else
   else if (d == Depth(0))
       phasePtr = QsearchWithChecksPhaseTable;
   else
@@ -116,7 +120,7 @@ Move MovePicker::get_next_move() {
     switch (*phasePtr) {
 
     case PH_NULL_MOVE:
     switch (*phasePtr) {
 
     case PH_NULL_MOVE:
-        break;
+        return MOVE_NULL;
 
     case PH_TT_MOVES:
         movesPicked = 0; // This is used as index to ttMoves[]
 
     case PH_TT_MOVES:
         movesPicked = 0; // This is used as index to ttMoves[]