mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Merge some if statements in pos_is_ok()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
c0964fc70f
commit
7b31e81d77
1 changed files with 4 additions and 12 deletions
|
@ -1541,11 +1541,9 @@ bool Position::pos_is_ok(int* failedStep) const {
|
|||
return false;
|
||||
|
||||
if ((*step)++, debugNonPawnMaterial)
|
||||
{
|
||||
if ( st->npMaterial[WHITE] != compute_non_pawn_material(WHITE)
|
||||
|| st->npMaterial[BLACK] != compute_non_pawn_material(BLACK))
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((*step)++, debugPieceCounts)
|
||||
for (Color c = WHITE; c <= BLACK; c++)
|
||||
|
@ -1557,14 +1555,10 @@ bool Position::pos_is_ok(int* failedStep) const {
|
|||
for (Color c = WHITE; c <= BLACK; c++)
|
||||
for (PieceType pt = PAWN; pt <= KING; pt++)
|
||||
for (int i = 0; i < pieceCount[c][pt]; i++)
|
||||
{
|
||||
if (board[pieceList[c][pt][i]] != make_piece(c, pt))
|
||||
if ( board[pieceList[c][pt][i]] != make_piece(c, pt)
|
||||
|| index[pieceList[c][pt][i]] != i)
|
||||
return false;
|
||||
|
||||
if (index[pieceList[c][pt][i]] != i)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((*step)++, debugCastleSquares)
|
||||
for (Color c = WHITE; c <= BLACK; c++)
|
||||
for (CastlingSide s = KING_SIDE; s <= QUEEN_SIDE; s = CastlingSide(s + 1))
|
||||
|
@ -1574,10 +1568,8 @@ bool Position::pos_is_ok(int* failedStep) const {
|
|||
if (!can_castle(cr))
|
||||
continue;
|
||||
|
||||
if ((castleRightsMask[king_square(c)] & cr) != cr)
|
||||
return false;
|
||||
|
||||
if ( piece_on(castleRookSquare[c][s]) != make_piece(c, ROOK)
|
||||
if ( (castleRightsMask[king_square(c)] & cr) != cr
|
||||
|| piece_on(castleRookSquare[c][s]) != make_piece(c, ROOK)
|
||||
|| castleRightsMask[castleRookSquare[c][s]] != cr)
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue