-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathLumberjackBotSolver.py
37 lines (32 loc) · 1.17 KB
/
LumberjackBotSolver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pyautogui
from time import sleep
from pyscreeze import screenshot
GAME_URL = 'https://tbot.xyz/lumber/#...'
WEBDRIVER_PATH = '/home/test/Downloads/chromedriver'
browser = Chrome(WEBDRIVER_PATH)
browser.get(GAME_URL)
sleep(10)
#Start game
buttonLeft = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, "button_left")))
buttonLeft.click()
buttonRight = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, "button_right")))
for _ in range(300):
scs = screenshot()
manLeft = scs.getpixel((540, 550))
manLeft = manLeft[0]>205
for y in range(478,278,-7):
branchLeft = scs.getpixel((540, y))
print(branchLeft)
branchRight = scs.getpixel((660, y))
if(branchLeft==(18,80,173)):
pyautogui.press("right")
pyautogui.press("right")
break
if(branchRight==(18,80,173)):
pyautogui.press("left")
pyautogui.press("left")
break