Skip to content

Commit

Permalink
exception of empty cells now takes into account only the cells that c…
Browse files Browse the repository at this point in the history
…an contain pieces
  • Loading branch information
ninetailsrabbit committed Jun 7, 2024
1 parent a5da72c commit 27e59ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Match3Maker/src/components/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ public Board FillInitialBoard(bool allowMatchesOnStart = false, Dictionary<strin
}
}

if (EmptyCells().Count > 0)
if (EmptyCells().Where(cell => cell.CanContainPiece).Any())
throw new InvalidOperationException("Board->FillInitialBoard: After calling the function, some cells are still empty, the operation is not valid");


if (!allowMatchesOnStart && (preSelectedPieces is null || preSelectedPieces.IsEmpty()))
RemoveMatchesFromBoard();

Expand Down

0 comments on commit 27e59ac

Please sign in to comment.