Skip to content

Instantly share code, notes, and snippets.

@abrasumente233
Created June 17, 2018 16:57
Show Gist options
  • Save abrasumente233/95a58bf82e50e1fa684c02909013a5d2 to your computer and use it in GitHub Desktop.
Save abrasumente233/95a58bf82e50e1fa684c02909013a5d2 to your computer and use it in GitHub Desktop.
LumberJack 手残助手,最高 445,再微调估计可以更高。手动再见
import time
from PIL import ImageGrab
import pyautogui
wood_color = (161, 116, 56)
right_first = (542, 631)
left_first = (406, 631)
n_woods = 6
retry_cords = (475, 909)
left = (389, 915)
right = (560, 914)
cur_pos = left_first
i = 0
n = 1000
while i < n:
image = ImageGrab.grab();
if i == 0:
offset_speed = 0
else:
offset_speed = 14
if image.getpixel(retry_cords) == wood_color:
break
actions = []
for offset in range(0, n_woods * 100, 50):
pos = (cur_pos[0], cur_pos[1] - offset - offset_speed)
if image.getpixel(pos) == wood_color:
actions.append(left if cur_pos == right_first else right)
cur_pos = left_first if cur_pos == right_first else right_first
else:
actions.append(left if cur_pos == left_first else right)
for action in actions:
pyautogui.click(action)
time.sleep(0.0001)
time.sleep(0.01)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment