diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs index 9543a70..9e5bf92 100644 --- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs @@ -552,7 +552,7 @@ namespace QwirkleClassLibrary.Games return false; } - public static bool CheckTileInCompletedLines(Tile? t1, Tile? t2, ref int nbTiles, ref List checkdoubles) + public static bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List checkdoubles) { if (t1 != null) { @@ -565,19 +565,7 @@ namespace QwirkleClassLibrary.Games checkdoubles.Add(t1); } - - if (t2 == null) return true; - { - nbTiles++; - - if (checkdoubles.Any(t => t.CompareTo(t2) == 0)) - { - return false; - } - - checkdoubles.Add(t2); - } - + return true; } @@ -594,8 +582,10 @@ namespace QwirkleClassLibrary.Games { break; } - - return CheckTileInCompletedLines(extendedCell?.Tile, extendedCell2?.Tile, ref nbTiles, ref checkdoubles); + + if(!CheckTileInCompletedLines(extendedCell?.Tile, ref nbTiles, ref checkdoubles)) return false; + + if(!CheckTileInCompletedLines(extendedCell2?.Tile, ref nbTiles, ref checkdoubles)) return false; } return nbTiles <= 6;