diff --git a/src/movepick.cpp b/src/movepick.cpp index eb7c45837..dd6d71167 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -318,8 +318,13 @@ void MovePicker::skip_quiet_moves() { skipQuiets = true; } // this function must be called after all quiet moves and captures have been generated bool MovePicker::can_move_king_or_pawn() const { - // SEE negative captures shouldn't be returned in GOOD_CAPTURE stage - assert(stage > GOOD_CAPTURE && stage != EVASION_INIT); + + assert((GOOD_QUIET <= stage && stage <= BAD_QUIET) || stage == EVASION); + + // Until good capture state no quiet moves are generated for comparison so simply assume king or pawns can move. + // Do the same for other states that don't have a valid available move list. + if ((GOOD_QUIET > stage || stage > BAD_QUIET) && stage != EVASION) + return true; for (const ExtMove* m = moves; m < endGenerated; ++m) { diff --git a/src/movepick.h b/src/movepick.h index 9d6c02b0e..6a3305c6c 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -67,7 +67,7 @@ class MovePicker { const PieceToHistory** continuationHistory; const PawnHistory* pawnHistory; Move ttMove; - ExtMove * cur, *endCur, *endBadCaptures, *endCaptures, *endGenerated; + ExtMove * cur, *endCur, *endBadCaptures, *endCaptures, *endGenerated = moves; int stage; int threshold; Depth depth;