From b0056e89166a3ba13b622d8ea44f2f0183321e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Mon, 8 Jan 2024 23:34:42 +0100 Subject: [PATCH] Fix assertion --- src/Lynx/Model/Move.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Lynx/Model/Move.cs b/src/Lynx/Model/Move.cs index 03ec9c2ad..3cb6526b9 100644 --- a/src/Lynx/Model/Move.cs +++ b/src/Lynx/Model/Move.cs @@ -153,7 +153,9 @@ public static bool TryParseFromUCIString(ReadOnlySpan UCIString, Span= 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"); } } }