summaryrefslogtreecommitdiff
path: root/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.c')
-rwxr-xr-xsrc/board.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/board.c b/src/board.c
index 0b195be..814b045 100755
--- a/src/board.c
+++ b/src/board.c
@@ -170,6 +170,7 @@ Return value:
"Fifty move counter is too high",
"bbPieces bitboard doesn't match piece list",
"bbPawns bitboard doesn't match pawn list",
+ "bbOccupied bitboard doesn't match piece list",
};
ULONG u, v;
COOR c;
@@ -179,6 +180,7 @@ Return value:
ULONG uNonPawnCount[2][7];
BITBOARD bbPieces[2][8];
BITBOARD bbPawns[2];
+ BITBOARD bbOccupied = 0;
ULONG uSigmaNonPawnCount[2] = {0, 0};
ULONG uWhiteSqBishopCount[2] = {0, 0};
UINT64 u64Computed;
@@ -272,6 +274,7 @@ Return value:
uPawnMaterial[u] += VALUE_PAWN;
uPawnCount[u]++;
bbPawns[u] |= COOR_TO_BB(c);
+ bbOccupied |= COOR_TO_BB(c);
}
}
@@ -316,6 +319,7 @@ Return value:
{
bbPieces[u][PIECE_TYPE(p)] |= COOR_TO_BB(c);
}
+ bbOccupied |= COOR_TO_BB(c);
uNonPawnMaterial[u] += PIECE_VALUE(p);
if ((IS_BISHOP(p)) &&
(IS_WHITE_SQUARE_COOR(c)))
@@ -394,6 +398,12 @@ Return value:
}
}
+ if (pos->bbOccupied != bbOccupied)
+ {
+ uReason = 23;
+ goto end;
+ }
+
//
// Now walk the actual board and reduce the material counts we got
// by walking the piece lists. If everything is ok then the