-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSequenceMemory.py
More file actions
48 lines (42 loc) · 1.57 KB
/
SequenceMemory.py
File metadata and controls
48 lines (42 loc) · 1.57 KB
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
42
43
44
45
46
47
import pyautogui
import time
WHITE = (255, 255, 255)
COORDINATES = [[790, 400], [950, 400], [1110, 400], [790, 570], [950, 570], [1110, 570], [790, 740], [950, 740],
[1110, 740]]
def sequenceMemory():
num = 1
time.sleep(3)
pyautogui.click(950, 700)
while True:
moves = []
while True:
screenshot = pyautogui.screenshot()
if screenshot.getpixel((790, 400)) == WHITE:
moves.append(0)
elif screenshot.getpixel((950, 400)) == WHITE:
moves.append(1)
elif screenshot.getpixel((1110, 400)) == WHITE:
moves.append(2)
elif screenshot.getpixel((790, 570)) == WHITE:
moves.append(3)
elif screenshot.getpixel((950, 570)) == WHITE:
moves.append(4)
elif screenshot.getpixel((1110, 570)) == WHITE:
moves.append(5)
elif screenshot.getpixel((790, 740)) == WHITE:
moves.append(6)
elif screenshot.getpixel((950, 740)) == WHITE:
moves.append(7)
elif screenshot.getpixel((1110, 740)) == WHITE:
moves.append(8)
if len(moves) == num:
time.sleep(0.5)
break
time.sleep(0.475)
if num == 70:
pyautogui.click(COORDINATES[(moves[0]+1) % 9][0], COORDINATES[(moves[0]+1) % 9][1])
break
for move in moves:
pyautogui.click(COORDINATES[move][0], COORDINATES[move][1])
num += 1
pyautogui.click(880, 740)