mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Add assertion for the maximum number of pawns
No functionl change Closes #1039
This commit is contained in:
parent
c5de4080db
commit
06eba14dc9
2 changed files with 5 additions and 1 deletions
|
@ -54,7 +54,7 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
// PawnsSet[count] contains a bonus/malus indexed by number of pawns
|
// PawnsSet[count] contains a bonus/malus indexed by number of pawns
|
||||||
const int PawnsSet[9] = {
|
const int PawnsSet[FILE_NB + 1] = {
|
||||||
24, -32, 107, -51, 117, -9, -126, -21, 31
|
24, -32, 107, -51, 117, -9, -126, -21, 31
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1192,6 +1192,7 @@ bool Position::pos_is_ok(int* failedStep) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step == Lists)
|
if (step == Lists)
|
||||||
|
{
|
||||||
for (Piece pc : Pieces)
|
for (Piece pc : Pieces)
|
||||||
{
|
{
|
||||||
if (pieceCount[pc] != popcount(pieces(color_of(pc), type_of(pc))))
|
if (pieceCount[pc] != popcount(pieces(color_of(pc), type_of(pc))))
|
||||||
|
@ -1201,6 +1202,9 @@ bool Position::pos_is_ok(int* failedStep) const {
|
||||||
if (board[pieceList[pc][i]] != pc || index[pieceList[pc][i]] != i)
|
if (board[pieceList[pc][i]] != pc || index[pieceList[pc][i]] != i)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (pieceCount[PAWN] > FILE_NB)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (step == Castling)
|
if (step == Castling)
|
||||||
for (Color c = WHITE; c <= BLACK; ++c)
|
for (Color c = WHITE; c <= BLACK; ++c)
|
||||||
|
|
Loading…
Add table
Reference in a new issue