Neccor 4 years ago
parent
commit
522829d635
1 changed files with 112 additions and 112 deletions
  1. 112
    112
      main.py

+ 112
- 112
main.py View File

@@ -3,6 +3,7 @@ import time, random
3 3
 import pyautogui
4 4
 from datetime import datetime, date
5 5
 
6
+print(f"Hello")
6 7
 
7 8
 def find_image(image, coef=None):
8 9
 	print(f"\n[find_image] {image}")
@@ -27,136 +28,135 @@ def sleeper():
27 28
 
28 29
 
29 30
 def loose_loop(loose_rounds):
30
-	while True:
31
-		sleeper()
32
-		pyautogui.screenshot("screenshot.png")
31
+	sleeper()
32
+	pyautogui.screenshot("screenshot.png")
33 33
 
34
-		v_options = False
35
-		v_surrender = False
36
-		v_ok = False
37
-		v_continue = False
38
-		v_ready = False
34
+	v_options = False
35
+	v_surrender = False
36
+	v_ok = False
37
+	v_continue = False
38
+	v_ready = False
39 39
 
40
-		loose_rounds += 1
41
-		print(loose_rounds)
40
+	loose_rounds += 1
41
+	print(loose_rounds)
42 42
 
43
-		# Options
43
+	# Options
44 44
 
45
-		v_options_counter = 0
46
-		while v_options == False:
45
+	v_options_counter = 0
46
+	while v_options == False:
47
+		sleeper()
48
+		pyautogui.screenshot("screenshot.png")
49
+		options = find_image("options.png")
50
+		if options != None:
51
+			v_options = True
52
+			pyautogui.click((options[0], options[1]))
53
+		elif v_options_counter >= 10:
54
+			v_options = True
55
+			print(f"Skip options")
56
+		else:
57
+			print(f"Zahnräder nicht gefunden")
47 58
 			sleeper()
48
-			pyautogui.screenshot("screenshot.png")
49
-			options = find_image("options.png")
50
-			if options != None:
51
-				v_options = True
52
-				pyautogui.click((options[0], options[1]))
53
-			elif v_options_counter >= 10:
54
-				v_options = True
55
-				print(f"Skip options")
56
-			else:
57
-				print(f"Zahnräder nicht gefunden")
58
-				sleeper()
59
-
60
-		# Surrender
61
-
62
-		v_surrender_counter = 0
63
-		while v_surrender == False:
59
+
60
+	# Surrender
61
+
62
+	v_surrender_counter = 0
63
+	while v_surrender == False:
64
+		sleeper()
65
+		pyautogui.screenshot("screenshot.png")
66
+		surrender = find_image("surrender.png")
67
+		if surrender != None:
68
+			v_surrender = True
69
+			pyautogui.click((surrender[0], surrender[1]))
70
+		elif v_surrender_counter >= 10:
71
+			v_surrender = True
72
+			print(f"Skip options")
73
+		else:
74
+			print(f"Surrender nicht gefunden")
64 75
 			sleeper()
65
-			pyautogui.screenshot("screenshot.png")
66
-			surrender = find_image("surrender.png")
67
-			if surrender != None:
68
-				v_surrender = True
69
-				pyautogui.click((surrender[0], surrender[1]))
70
-			elif v_surrender_counter >= 10:
71
-				v_surrender = True
72
-				print(f"Skip options")
73
-			else:
74
-				print(f"Surrender nicht gefunden")
75
-				sleeper()
76
-
77
-		# OK
78
-
79
-		v_ok_counter = 0
80
-		while v_ok == False:
76
+
77
+	# OK
78
+
79
+	v_ok_counter = 0
80
+	while v_ok == False:
81
+		sleeper()
82
+		pyautogui.screenshot("screenshot.png")
83
+		ok = find_image("ok.png")
84
+		if ok != None:
85
+			v_ok = True
86
+			pyautogui.click((ok[0], ok[1]))
87
+		elif v_ok_counter >= 10:
88
+			v_ok = True
89
+			print(f"Skip options")
90
+		else:
91
+			print(f"OK nicht gefunden")
81 92
 			sleeper()
82
-			pyautogui.screenshot("screenshot.png")
83
-			ok = find_image("ok.png")
84
-			if ok != None:
85
-				v_ok = True
86
-				pyautogui.click((ok[0], ok[1]))
87
-			elif v_ok_counter >= 10:
88
-				v_ok = True
89
-				print(f"Skip options")
90
-			else:
91
-				print(f"OK nicht gefunden")
92
-				sleeper()
93
-
94
-		# Continue
95
-
96
-		v_continue_counter = 0
97
-		while v_continue == False:
93
+
94
+	# Continue
95
+
96
+	v_continue_counter = 0
97
+	while v_continue == False:
98
+		sleeper()
99
+		pyautogui.screenshot("screenshot.png")
100
+		f_continue = find_image("continue.png")
101
+		if f_continue != None:
102
+			v_continue = True
103
+			pyautogui.click((f_continue[0], f_continue[1]))
104
+		elif v_continue_counter >= 10:
105
+			v_continue = True
106
+			print(f"Skip options")
107
+		else:
108
+			print(f"Continue nicht gefunden")
98 109
 			sleeper()
99
-			pyautogui.screenshot("screenshot.png")
100
-			f_continue = find_image("continue.png")
101
-			if f_continue != None:
102
-				v_continue = True
103
-				pyautogui.click((f_continue[0], f_continue[1]))
104
-			elif v_continue_counter >= 10:
105
-				v_continue = True
106
-				print(f"Skip options")
107
-			else:
108
-				print(f"Continue nicht gefunden")
109
-				sleeper()
110
-
111
-		# Ready
112
-
113
-		v_ready_counter = 0
114
-		while v_ready == False:
110
+
111
+	# Ready
112
+
113
+	v_ready_counter = 0
114
+	while v_ready == False:
115
+		sleeper()
116
+		pyautogui.screenshot("screenshot.png")
117
+		ready = find_image("ready.png")
118
+		if ready != None:
119
+			v_ready = True
120
+			pyautogui.click((ready[0], ready[1]))
121
+		elif v_ready_counter >= 10:
122
+			v_ready = True
123
+			print(f"Skip options")
124
+		else:
125
+			print(f"Ready nicht gefunden")
115 126
 			sleeper()
116
-			pyautogui.screenshot("screenshot.png")
117
-			ready = find_image("ready.png")
118
-			if ready != None:
119
-				v_ready = True
120
-				pyautogui.click((ready[0], ready[1]))
121
-			elif v_ready_counter >= 10:
122
-				v_ready = True
123
-				print(f"Skip options")
124
-			else:
125
-				print(f"Ready nicht gefunden")
126
-				sleeper()
127 127
 
128
-		print(f"\n\n Loop complete restarting \nRunde {loose_rounds} absolviert\n\n")
128
+	print(f"\n\n Loop complete restarting \nRunde {loose_rounds} absolviert\n\n")
129 129
 
130
-		if loose_rounds >= 30:
131
-			print(f"{loose_rounds} Spiele absolviert\nWechsle Modus")
130
+	if loose_rounds >= 30:
131
+		print(f"{loose_rounds} Spiele absolviert\nWechsle Modus")
132 132
 
133 133
 
134 134
 def win_loop(win_rounds):
135
-	while True:
136
-		time.sleep(1)
135
+	time.sleep(1)
137 136
 
138
-		while win_rounds >= 31:
137
+	while win_rounds <= 31:
138
+		time.sleep(1)
139
+		pyautogui.screenshot("screenshot.png")
140
+		f_continue = find_image("continue.png")
141
+		f_ready = find_image("ready.png")
142
+		if f_continue != None:
143
+			pyautogui.click((f_continue[0], f_continue[1]))
144
+		elif f_ready != None:
145
+			pyautogui.click((f_ready[0], f_ready[1]))
146
+			win_rounds += 1
147
+			print(f"Siege: {win_rounds}")
148
+		else:
149
+			print(f"Kein Ergebniss gefunden")
139 150
 			time.sleep(1)
140
-			pyautogui.screenshot("screenshot.png")
141
-			f_continue = find_image("continue.png")
142
-			f_ready = find_image("ready.png")
143
-			if f_continue != None:
144
-				pyautogui.click((f_continue[0], f_continue[1]))
145
-			elif f_ready != None:
146
-				pyautogui.click((f_ready[0], f_ready[1]))
147
-				win_rounds += 1
148
-				print(f"Siege: {win_rounds}")
149
-			else:
150
-				print(f"Kein Ergebniss gefunden")
151
-				time.sleep(1)
152 151
 
153 152
 
153
+# Siege
154
+win_rounds = 0
155
+while win_rounds <= 3:
156
+	print("winorund loop")
157
+	win_loop(win_rounds)
158
+
154 159
 # Niederlage
155 160
 loose_rounds = 0
156
-while loose_rounds <= 30:
161
+while loose_rounds <= 3:
157 162
 	loose_loop(loose_rounds)
158
-
159
-# Siege
160
-win_rounds = 0
161
-while win_rounds <= 30:
162
-	win_loop(win_rounds)

Loading…
Cancel
Save