// Loop through the moves, and see if one of them gives mate
Bitboard pinned = pinned_pieces(sideToMove);
CheckInfo ci(*this);
- for (cur = mlist; cur != last && !mateFound; cur++)
+ for (cur = mlist; !mateFound && cur != last; cur++)
{
Move move = cur->move;
if ( !pl_move_is_legal(move, pinned)
continue;
do_move(move, st2, ci, true);
-
- if (is_mate())
- mateFound = true;
-
+ mateFound = is_mate();
undo_move(move);
}
if (failedStep) (*failedStep)++;
if (debugPieceList)
- {
for (Color c = WHITE; c <= BLACK; c++)
for (PieceType pt = PAWN; pt <= KING; pt++)
for (int i = 0; i < pieceCount[c][pt]; i++)
if (index[piece_list(c, pt, i)] != i)
return false;
}
- }
if (failedStep) (*failedStep)++;
- if (debugCastleSquares) {
- for (Color c = WHITE; c <= BLACK; c++) {
+ if (debugCastleSquares)
+ {
+ for (Color c = WHITE; c <= BLACK; c++)
+ {
if (can_castle_kingside(c) && piece_on(initial_kr_square(c)) != make_piece(c, ROOK))
return false;
+
if (can_castle_queenside(c) && piece_on(initial_qr_square(c)) != make_piece(c, ROOK))
return false;
}