diff --git a/polyomino/problem.py b/polyomino/problem.py index 9c40c4a..5e4c9e2 100644 --- a/polyomino/problem.py +++ b/polyomino/problem.py @@ -1,6 +1,7 @@ import numpy as np from exact_cover import get_exact_cover +from exact_cover.error import NoSolution from .error import CantPlaceSinglePiece from .solution import Solution @@ -60,7 +61,10 @@ def make_problem(self): def solve(self): self.make_problem() - solution = get_exact_cover(self.array) + try: + solution = get_exact_cover(self.array) + except NoSolution: + return None tiling = [self.key[s] for s in solution] if tiling: return Solution(tiling, self.board) diff --git a/pyproject.toml b/pyproject.toml index 7bc2135..112ac61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "polyomino" -version = "0.6.6" +version = "0.7.0" description = "Solve polyomino tiling problems." readme = "README.md" authors = ["Jack Grahl "] @@ -8,8 +8,7 @@ license = "MIT" [tool.poetry.dependencies] python = "^3.7.1" -exact-cover = "0.4.3" -numpy = "^1.20" +exact-cover = "1.3.0" pretty-poly = "0.2.0" [tool.poetry.dev-dependencies] @@ -17,12 +16,14 @@ pytest = "^6.2.1" hypothesis = "^6.0.2" pytest-profiling = "^1.7.0" black = "^21.6b0" -pytest-fail-slow = "^0.1.0" [tool.poetry.scripts] test = 'run_tests:run_tests' doctest = 'run_tests:run_doctests' +[tool.poetry.group.dev.dependencies] +pytest-fail-slow = ">=0.2.0,<0.3.0" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"