-
Notifications
You must be signed in to change notification settings - Fork 1
/
CHROME DINO AUTOMATION.py
42 lines (36 loc) · 1.08 KB
/
CHROME DINO AUTOMATION.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
38
39
40
41
from pyautogui import * # pip install pyautogui
from PIL import Image, ImageGrab # pip install pillow
import time
def isCollide(data):
# Draw the rectangle for birds
for i in range(300, 415):
for j in range(410, 563):
if data[i, j] < 100:
keyDown("down")
return
for i in range(300, 415):
for j in range(563, 650):
if data[i, j] < 100:
keyDown("up")
return
return
if __name__ == "__main__":
print("Hey.. Dino game about to start in 3 seconds")
time.sleep(2)
while True:
image = ImageGrab.grab().convert('L')
data = image.load()
isCollide(data)
# print(asarray(image))
'''
# Draw the rectangle for cactus
for i in range(275, 325):
for j in range(563, 650):
data[i, j] = 0
# Draw the rectangle for birds
for i in range(250, 300):
for j in range(410, 563):
data[i, j] = 171
image.show()
break
'''