From 252844e899515d48c0db1153ef5e91bdd8c6679f Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 29 Jan 2010 16:47:04 +0100 Subject: [PATCH] Avoid search tree explosion in qsearch Under some rare cases we can have a search tree explosion due to a perpetual check or to a very long non-capture TT sequence. This avoids the tree explosion not following TT moves that are not captures or promotions when we are below the 'generate checks' depth. Idea suggested by Richard Vida. Signed-off-by: Marco Costalba --- src/movepick.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/movepick.cpp b/src/movepick.cpp index 16eb1634..638f8175 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -94,8 +94,16 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, else if (d == Depth(0)) phasePtr = QsearchWithChecksPhaseTable; else + { phasePtr = QsearchWithoutChecksPhaseTable; + // Skip TT move if is not a capture or a promotion, this avoids + // qsearch tree explosion due to a possible perpetual check or + // similar rare cases when TT table is full. + if (ttm != MOVE_NONE && !pos.move_is_capture_or_promotion(ttm)) + searchTT = ttMoves[0].move = MOVE_NONE; + } + phasePtr += !searchTT - 1; go_next_phase(); }