From 4f682dc3706ae35a55b9d89ef3befe00a76b7f62 Mon Sep 17 00:00:00 2001 From: pd2 Date: Thu, 6 Nov 2025 21:03:51 +0000 Subject: [PATCH] Update pentomino.py --- pentomino.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pentomino.py b/pentomino.py index b0b2ed2..e08f8bc 100755 --- a/pentomino.py +++ b/pentomino.py @@ -154,7 +154,7 @@ def update_board(self, piece, r, c): if piece.shape[pr][pc] != Shape.EMPTY: self.board[r+pr][c+pc] = piece.shape[pr][pc] - def find_solutions(self): + def find_solutions(self, is_it_solvable=None): # X-Constraints # Board: For each of the board squares, there is the constraint that it must be # covered by a pentomino exactly once. Name these constraints after the @@ -189,6 +189,8 @@ def find_solutions(self): for rotation, r, c in solution_keys: solution.update(rotation, r, c) yield solution + if is_it_solvable: + return if __name__ == '__main__':