Version 1.4

Probably, this is final version.
This commit is contained in:
Enrique Moran 2016-12-15 16:14:25 +01:00 committed by GitHub
parent ac01151887
commit 93a1cdd2e4

View file

@ -22,12 +22,11 @@ class lumberjackBot():
def move(self, direction): def move(self, direction):
speed = 0.027
if direction == "left": if direction == "left":
pyautogui.typewrite(['left']) pyautogui.typewrite(['left', 'left'], speed)
pyautogui.typewrite(['left'])
elif direction == "right": elif direction == "right":
pyautogui.typewrite(['right']) pyautogui.typewrite(['right', 'right'], speed)
pyautogui.typewrite(['right'])
def get_color(self, rgb): def get_color(self, rgb):
r = rgb & 0xff r = rgb & 0xff
@ -46,11 +45,12 @@ class lumberjackBot():
def play(self): def play(self):
self.move("right") self.move("right")
while True: while True:
if self.pixelL == (161, 116, 56): # or self.pixelL == (153, 110, 54): if self.pixelL == (161, 116, 56):
self.move("right") self.move("right")
elif self.pixelR == (161, 116, 56): # or self.pixelR == (153, 110, 54): elif self.pixelR == (161, 116, 56):
self.move("left") self.move("left")
def pixelThreadL(self): def pixelThreadL(self):
while True: while True:
self.get_pixel(self.lX, self.y, 'L') self.get_pixel(self.lX, self.y, 'L')