X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovepick.cpp;fp=src%2Fmovepick.cpp;h=883135d491798a292be297af44d66fbd0948d522;hp=3bc56751f94c3710ddc1051362fc1ac87a1f1c56;hb=5c2fbcd09b43bd6867780a3ace303ffb1e09d763;hpb=7b4f9c37cb859ba6258ba90d11358879c0b2c57d diff --git a/src/movepick.cpp b/src/movepick.cpp index 3bc56751..883135d4 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -67,7 +67,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist assert(d > DEPTH_ZERO); stage = pos.checkers() ? EVASION_TT : MAIN_TT; - ttMove = pos.pseudo_legal(ttm) ? ttm : MOVE_NONE; + ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE; stage += (ttMove == MOVE_NONE); } @@ -79,8 +79,9 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist assert(d <= DEPTH_ZERO); stage = pos.checkers() ? EVASION_TT : QSEARCH_TT; - ttMove = pos.pseudo_legal(ttm) - && (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE; + ttMove = ttm + && pos.pseudo_legal(ttm) + && (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE; stage += (ttMove == MOVE_NONE); } @@ -92,7 +93,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePiece assert(!pos.checkers()); stage = PROBCUT_TT; - ttMove = pos.pseudo_legal(ttm) + ttMove = ttm + && pos.pseudo_legal(ttm) && pos.capture(ttm) && pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE; stage += (ttMove == MOVE_NONE); @@ -192,7 +194,8 @@ top: /* fallthrough */ case REFUTATION: - if (select([&](){ return !pos.capture(move) + if (select([&](){ return move != MOVE_NONE + && !pos.capture(move) && pos.pseudo_legal(move); })) return move; ++stage;