summaryrefslogtreecommitdiff
path: root/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.c')
-rwxr-xr-xsrc/board.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/board.c b/src/board.c
index 5ad0d17..0c5f4df 100755
--- a/src/board.c
+++ b/src/board.c
@@ -168,6 +168,7 @@ Return value:
"More pieces on board than accounted for in piece material",
"Extra pieces on board that are not accounted for",
"Fifty move counter is too high",
+ "bbPieces bitboard doesn't match piece list",
};
ULONG u, v;
COOR c;
@@ -175,6 +176,7 @@ Return value:
ULONG uPawnCount[2] = {0, 0};
ULONG uNonPawnMaterial[2] = {0, 0};
ULONG uNonPawnCount[2][7];
+ BITBOARD bbPieces[2][8];
ULONG uSigmaNonPawnCount[2] = {0, 0};
ULONG uWhiteSqBishopCount[2] = {0, 0};
UINT64 u64Computed;
@@ -183,6 +185,7 @@ Return value:
ULONG uReason = (ULONG)-1;
memset(uNonPawnCount, 0, sizeof(uNonPawnCount));
+ memset(bbPieces, 0, sizeof(bbPieces));
u64Computed = ComputeSig(pos);
if (pos->u64NonPawnSig != u64Computed)
{
@@ -305,6 +308,10 @@ Return value:
goto end;
}
uNonPawnCount[u][PIECE_TYPE(p)]++;
+ if (!IS_KING(p))
+ {
+ bbPieces[u][PIECE_TYPE(p)] |= COOR_TO_BB(c);
+ }
uNonPawnMaterial[u] += PIECE_VALUE(p);
if ((IS_BISHOP(p)) &&
(IS_WHITE_SQUARE_COOR(c)))
@@ -348,6 +355,15 @@ Return value:
uSigmaNonPawnCount[u] += pos->uNonPawnCount[u][v];
}
+ for (v = KNIGHT; v < KING; v++)
+ {
+ if (pos->bbPieces[u][v] != bbPieces[u][v])
+ {
+ uReason = 21;
+ goto end;
+ }
+ }
+
//
// Note: the 0th spot in the array is the sum of all non pawns
//