Skip to content

Commit

Permalink
Fix assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 8, 2024
1 parent bf8d321 commit b0056e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Lynx/Model/Move.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public static bool TryParseFromUCIString(ReadOnlySpan<char> UCIString, Span<Move
return true;
}

Debug.Assert(moveList.Length == 4, "There will be 4 and always 4 moves that match sourceSquare and targetSquare when there is a promotion");
Debug.Assert(moveList.Length >= 4, "There will be at least 4 moves that match sourceSquare and targetSquare when there is a promotion");
Debug.Assert(moveList.ToArray().Count(m => m.PromotedPiece() != default) == 4 || moveList.ToArray().Count(m => m.PromotedPiece() != default) == 8, "There will be either 4 or 8 moves that are a promotion");
Debug.Assert(moveList.ToArray().Count(m => m.SourceSquare() == sourceSquare && m.TargetSquare() == targetSquare && m.PromotedPiece() != default) == 4, "There will be 4 (and always 4) moves that match sourceSquare and targetSquare when there is a promotion");
}
}
}
Expand Down

0 comments on commit b0056e8

Please sign in to comment.