From 2dca549f21c2a222138e740d3d9697c51ee7762b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6lfer?= Date: Thu, 13 Feb 2020 00:12:14 +0100 Subject: [PATCH] Fixed test --- test/test_chain.py | 2 +- tools/assistant.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test_chain.py b/test/test_chain.py index fa87771..593e0e6 100644 --- a/test/test_chain.py +++ b/test/test_chain.py @@ -77,7 +77,7 @@ class ChainTest(unittest.TestCase): source_id=6, source_row_index=2, source_position=Position.Field, - obvious=False, + obvious=True, goal_id=0, ), ] diff --git a/tools/assistant.py b/tools/assistant.py index 1d2de6a..a16ee58 100644 --- a/tools/assistant.py +++ b/tools/assistant.py @@ -16,6 +16,7 @@ OFFSET = (0, 0) SIZE = (2560, 1440) NEW_BUTTON = (1900, 1100) +SAVE_UNSOLVED = False def solve() -> None: with tempfile.TemporaryDirectory() as screenshot_dir: @@ -33,12 +34,13 @@ def solve() -> None: if solution_iterator is None: clicker.click(NEW_BUTTON, OFFSET) time.sleep(10) - fd, outfile = tempfile.mkstemp( - dir="E:/shenzhen-solitaire/unsolved", suffix=".png" - ) - sock = os.fdopen(fd, "w") - sock.close() - cv2.imwrite(outfile, image) + if SAVE_UNSOLVED: + fd, outfile = tempfile.mkstemp( + dir="E:/shenzhen-solitaire/unsolved", suffix=".png" + ) + sock = os.fdopen(fd, "w") + sock.close() + cv2.imwrite(outfile, image) return solution = list(solution_iterator) print(f"Solved in {len(solution)} steps")