-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathv2p2_partida.py
335 lines (310 loc) · 15.8 KB
/
v2p2_partida.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
from random import randint, choice
def resultado(forcaA, forcaB, jogA, jogB, pro=False, dec=False):
# zerando o relogio
minutagem = 1
# variaveis time A e B
golsA, golsB = 0, 0
coletivoA = (100*forcaA/(forcaA+forcaB))/3
coletivoB = (100*forcaB/(forcaA+forcaB))/3
ataqueA = randint(0, forcaA)
ataqueB = randint(0, forcaB)
defesaA = randint(0, forcaA + int(coletivoA))
defesaB = randint(0, forcaB + int(coletivoB))
meioA = randint(0, int((forcaA+ataqueA+defesaA)/3))
meioB = randint(0, int((forcaB+ataqueB+defesaB)/3))
# chance de cada jogador fazer gol - %Goleiro < 1/343
goljog = [10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
10, 10, 10, 10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 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
3, 3, 3, 2, 2, 2, 1, 1, 1,
3, 3, 3, 2, 2, 2, 1, 1, 1,
3, 3, 3, 2, 2, 2, 1, 1, 1,
3, 3, 3, 2, 2, 2, 1, 1, 1,
3, 3, 3, 2, 2, 2, 1, 1, 1,
3, 3, 3, 2, 2, 2, 1, 1, 1,
0]
# variaveis globais
hora_do_golA = [1]
hora_do_golB = [1]
# len = 14 - 107 gols
# len = 15 - 94 gols
# len = 13 - 119 gols!!!! - 13 vai ser o nivel maximo
# O hora do gol vai ser menor quanto mais alto o nivel (len = 1300/nivel)
# ou seja, quanto maior o nivel, maior a chance de gol
if dec is False:
for k in range(0, int(1300/forcaA)):
hora_do_golA.append(0)
# print(hora_do_golA, k)
for k in range(0, int(1300/forcaB)):
hora_do_golB.append(0)
# print(hora_do_golB, k)
# print('Hora do Gol A e B finais acima!')
if dec is True:
for k in range(0, int(2200/forcaA)):
hora_do_golA.append(0)
# print(hora_do_golA, k)
for k in range(0, int(2200/forcaB)):
hora_do_golB.append(0)
# p/ reduzir a chance de gol a cada chance, 1/len(hora)
texto_GA = []
texto_GB = []
chanceA = choice(hora_do_golA)
chanceB = choice(hora_do_golB)
c_g_jog = choice(goljog)
grp_acrescimos = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5,
6, 6, 7, 7, 8, 9, 10]
acrescimos = choice(grp_acrescimos)
tempo_jogo = 90 + acrescimos
# ____________________________ Jogo Normal __________________
for minutagem in range(1, tempo_jogo):
if meioA > (meioB - coletivoA/2) and meioB > (meioA - coletivoB/2):
chanceA = 0
chanceB = 0
if (meioA > (meioB - coletivoA/2) and ataqueA > defesaB
and chanceA == 1):
golsA += 1
texto_GA.append(f"{jogA[c_g_jog]}, {minutagem}'")
if (meioB > (meioA - coletivoB/2) and ataqueB > defesaA
and chanceB == 1):
golsB += 1
texto_GB.append(f"{jogB[c_g_jog]}, {minutagem}'")
if golsA + golsB in range(2, 5) and minutagem % 5 == 0:
hora_do_golA.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
hora_do_golB.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
# p/ diminuir qtd de goleadas bizarras
if golsA + golsB > 6 and minutagem % 5 == 0:
hora_do_golA.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
hora_do_golB.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
# p/ diminuir qtd de goleadas bizarras
# resets:
chanceA = choice(hora_do_golA)
chanceB = choice(hora_do_golB)
ataqueA = randint(0, forcaA)
ataqueB = randint(0, forcaB)
meioA = randint(0, forcaA)
meioB = randint(0, forcaB)
defesaA = randint(0, forcaA)
defesaB = randint(0, forcaB)
acrescimos = choice(grp_acrescimos)
c_g_jog = choice(goljog)
minutagem += 1
# ____________________________ Fim do Jogo Normal __________________
# ____________________________ Prorrogacao __________________
if golsA == golsB and pro is True:
for minutagem in range(tempo_jogo, tempo_jogo + 31):
if meioA > (meioB - coletivoA) and meioB > (meioA - coletivoB):
chanceA = 0
chanceB = 0
if (meioA > (meioB - coletivoA) and ataqueA > defesaB
and chanceA == 1):
golsA += 1
texto_GA.append(f"{jogA[c_g_jog]}, {minutagem}'(Prorrogacao)")
if (meioB > (meioA - coletivoB) and ataqueB > defesaA
and chanceB == 1):
golsB += 1
texto_GB.append(f"{jogB[c_g_jog]}, {minutagem}'(Prorrogacao)")
if golsA + golsB in range(2, 5) and minutagem % 5 == 0:
hora_do_golA.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
hora_do_golB.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
# p/ diminuir qtd de goleadas bizarras
if golsA + golsB > 6 and minutagem % 5 == 0:
hora_do_golA.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
hora_do_golB.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0])
# p/ diminuir qtd de goleadas bizarras
chanceA = choice(hora_do_golA)
chanceB = choice(hora_do_golB)
ataqueA = randint(0, forcaA)
ataqueB = randint(0, forcaB)
meioA = randint(0, forcaA)
meioB = randint(0, forcaB)
defesaA = randint(0, forcaA)
defesaB = randint(0, forcaB)
acrescimos = choice(grp_acrescimos)
c_g_jog = choice(goljog)
minutagem += 1
# ____________________________ Fim da Prorrogacao __________________
if golsA == golsB:
zz = randint(1, 2)
# garante uma taxa de 0x0 em torno de 6 %
if zz == 1:
golsA, golsB = 0, 0
texto_GA = []
texto_GB = []
minsA = ''
minsB = ''
for gol in texto_GA:
minsA += f'| {gol} |'
for gol in texto_GB:
minsB += f'| {gol} |'
if golsA == 0:
minsA = 'Nenhum'
if golsB == 0:
minsB = 'Nenhum'
return(golsA, golsB, minsA, minsB)
def vit_prob(val_jogo, iteracoes=100000):
vit1 = 0
vit2 = 0
for joguitos in range(0, iteracoes):
p = resultado(*val_jogo)
if p[0] > p[1]:
vit1 += 1
elif p[1] > p[0]:
vit2 += 1
return [vit1, vit2]
if __name__ == '__main__':
jogaA = ['Leo',
'Brito', 'Eduardo', 'Bonini', 'Filipe',
'Gustavo', 'Tamarindo', 'Carotta', 'P. Augusto',
'Brayan', 'Carotta']
jogaB = ['Buffon',
'Marcelo', 'Sergio Ramos', 'Pique', 'Dani Alves',
'Pelé', 'Iniesta', 'Messi', 'Cristiano',
'Maradona', 'Garrincha']
for teste1 in range(0, 10):
for teste2 in range(0, 10):
val_jogo = (teste1*10 + 9, teste2*10 + 9, jogaA, jogaB)
final = vit_prob(val_jogo)
print(f"""
Nível {val_jogo[0]}: {final[0]} / Nível {val_jogo[1]}: {final[1]}'
""")