Fixed test
This commit is contained in:
@@ -77,7 +77,7 @@ class ChainTest(unittest.TestCase):
|
|||||||
source_id=6,
|
source_id=6,
|
||||||
source_row_index=2,
|
source_row_index=2,
|
||||||
source_position=Position.Field,
|
source_position=Position.Field,
|
||||||
obvious=False,
|
obvious=True,
|
||||||
goal_id=0,
|
goal_id=0,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ OFFSET = (0, 0)
|
|||||||
SIZE = (2560, 1440)
|
SIZE = (2560, 1440)
|
||||||
NEW_BUTTON = (1900, 1100)
|
NEW_BUTTON = (1900, 1100)
|
||||||
|
|
||||||
|
SAVE_UNSOLVED = False
|
||||||
|
|
||||||
def solve() -> None:
|
def solve() -> None:
|
||||||
with tempfile.TemporaryDirectory() as screenshot_dir:
|
with tempfile.TemporaryDirectory() as screenshot_dir:
|
||||||
@@ -33,12 +34,13 @@ def solve() -> None:
|
|||||||
if solution_iterator is None:
|
if solution_iterator is None:
|
||||||
clicker.click(NEW_BUTTON, OFFSET)
|
clicker.click(NEW_BUTTON, OFFSET)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
fd, outfile = tempfile.mkstemp(
|
if SAVE_UNSOLVED:
|
||||||
dir="E:/shenzhen-solitaire/unsolved", suffix=".png"
|
fd, outfile = tempfile.mkstemp(
|
||||||
)
|
dir="E:/shenzhen-solitaire/unsolved", suffix=".png"
|
||||||
sock = os.fdopen(fd, "w")
|
)
|
||||||
sock.close()
|
sock = os.fdopen(fd, "w")
|
||||||
cv2.imwrite(outfile, image)
|
sock.close()
|
||||||
|
cv2.imwrite(outfile, image)
|
||||||
return
|
return
|
||||||
solution = list(solution_iterator)
|
solution = list(solution_iterator)
|
||||||
print(f"Solved in {len(solution)} steps")
|
print(f"Solved in {len(solution)} steps")
|
||||||
|
|||||||
Reference in New Issue
Block a user