Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pentomino.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__':
Expand Down