-
Notifications
You must be signed in to change notification settings - Fork 0
/
memoryGamePlayer.py
90 lines (73 loc) · 2.01 KB
/
memoryGamePlayer.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cards = Pattern("cards.png")
cardsforFlipping = Pattern("cards2.png").similar(0.24)
winScreen = "winScreen.png"
cardLocations = {
"0": {
"x" : -314,
"y" : -89
},
"1": {
"x" : -164,
"y" : -84
},
"2": {
"x" : 4,
"y" : -103
},
"3": {
"x" : 159,
"y" : -93
},
"4": {
"x" : 314,
"y" : -93
},
"5": {
"x" : -324,
"y" : 98
},
"6": {
"x" : -164,
"y" : 84
},
"7": {
"x" : 0,
"y" : 93
},
"8": {
"x" : 150,
"y" : 93
},
"9": {
"x" : 324,
"y" : 84
}
}
foundCardsTypeArray = []
cardType = ["a","b","c","d","e"]
cardPairs = []
def assignCardType():
if exists("1634243925897.png",1):
foundCardsTypeArray.append("a")
elif exists("1634243942839.png",1):
foundCardsTypeArray.append("b")
elif exists("1634243962573.png",1):
foundCardsTypeArray.append("c")
elif exists("1634243984017.png",1):
foundCardsTypeArray.append("d")
elif exists("1634243999474.png",1):
foundCardsTypeArray.append("e")
for x in range(10):
click(cards.targetOffset(cardLocations[str(x)]["x"], cardLocations[str(x)]["y"]))
assignCardType()
click(cards.targetOffset(cardLocations[str(x)]["x"], cardLocations[str(x)]["y"]))
for y in range(len((cardType))):
for x in range(len(foundCardsTypeArray)):
if foundCardsTypeArray[x] == cardType[y]:
cardPairs.append(x)
else:
pass
for x in range(10):
click(cardsforFlipping.targetOffset(cardLocations[str(cardPairs[x])]["x"], cardLocations[str(cardPairs[x])]["y"]))
sleep(1)
popup(find(winScreen).text().lstrip(":"))