]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Add assertion for the maximum number of pawns
[stockfish] / src / position.cpp
index e20c822f5998902ba2149d13504bd9846a1833d0..7d0cde2146dc29e50a905f0090cf9378b1269943 100644 (file)
@@ -1192,6 +1192,7 @@ bool Position::pos_is_ok(int* failedStep) const {
       }
 
       if (step == Lists)
+      {
           for (Piece pc : Pieces)
           {
               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)
                       return false;
           }
+          if (pieceCount[PAWN] > FILE_NB)
+              return false;
+      }
 
       if (step == Castling)
           for (Color c = WHITE; c <= BLACK; ++c)