Formatting

This commit is contained in:
Lukas Wölfer
2020-02-12 00:53:02 +01:00
parent d752ffb24c
commit a8ead54831
7 changed files with 36 additions and 26 deletions

View File

@@ -12,7 +12,8 @@ import time
OFFSET = (0, 0)
SIZE = (2560, 1440)
NEW_BUTTON=(1900,1100)
NEW_BUTTON = (1900, 1100)
def debug_screenshot(image):
cv2.namedWindow("Name", cv2.WINDOW_KEEPRATIO)
@@ -21,14 +22,15 @@ def debug_screenshot(image):
input()
cv2.destroyAllWindows()
def solve() -> None:
screenshot_dir = Path(tempfile.mkdtemp())
screenshot_file = screenshot_dir / 'screenshot.png'
screenshot_file = screenshot_dir / "screenshot.png"
screenshot = pyautogui.screenshot(region=(*OFFSET, *SIZE))
screenshot.save(screenshot_file)
image = cv2.imread(str(screenshot_file))
# debug_screenshot()
print("Solving")
conf = configuration.load("test_config.zip")
board = parse_board(image, conf)
@@ -38,14 +40,16 @@ def solve() -> None:
time.sleep(1)
for step in solution:
print(step)
#time.sleep(0.5)
# time.sleep(0.5)
clicker.handle_action(step, OFFSET, conf)
clicker.click(NEW_BUTTON, OFFSET)
time.sleep(10)
def main() -> None:
time.sleep(3)
while True:
solve()
solve()
if __name__ == "__main__":

View File

@@ -13,4 +13,3 @@ def main() -> None:
if __name__ == "__main__":
main()

View File

@@ -15,7 +15,12 @@ def main() -> None:
image = cv2.imread("pictures/specific/BaiShiny.jpg")
goal_adjustment = adjustment.adjust_squares(
image, count_x=3, count_y=1, adjustment=adjustment.Adjustment(**{"x": 1490, "y": 310, "w": 19, "h": 21, "dx": 152, "dy": 0})
image,
count_x=3,
count_y=1,
adjustment=adjustment.Adjustment(
**{"x": 1490, "y": 310, "w": 19, "h": 21, "dx": 152, "dy": 0}
),
)
print(json.dumps(dataclasses.asdict(goal_adjustment)))