-
Notifications
You must be signed in to change notification settings - Fork 0
/
func_gameday.py
executable file
·183 lines (147 loc) · 3.89 KB
/
func_gameday.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
#!/usr/bin/python3.4
# this is used in working out who won a match
import random
import os
import mylog
#######################variables
#randomnumber=random.randint (1,10)
#randomnumber50=random.randint (1,10)
#randomnumber501=random.randint (1,10)
#randomnumber1=random.randint (1,10)
bigdiff=70
smalldif=20
#######################logic
## pass me the team value and i will do something clever
## lots of debugging to help catch crazy score lines and tweak logic
## Diffence % Win Draw Lose
## 100 80 10 10
## 50 70 20 10
## 30 50 30 20
## else 30 40 30
## if result is draw use char+exp to see if we can force a result
######################Clever stuff
def bat(ourgk,oppgk,ourdef,oppdef,ourmid,oppmid,ourata,oppata,ourchar,oppchar,ourexp,oppexp):
# create scores
ourdefscore=0
ourattackscore=0
oppdefscore=0
ourattackscore=0
oppattackscore=0
randomnumber=random.randint (1,10)
randomnumber50=random.randint (1,10)
randomnumber501=random.randint (1,10)
randomnumber1=random.randint (1,10)
mylog.fmlog(detail=str(("rn ", randomnumber)), verbosity=1)
mylog.fmlog(detail=str(("rn50 ", randomnumber50)), verbosity=1)
mylog.fmlog(detail=str(("rn501 ", randomnumber501)), verbosity=1)
mylog.fmlog(detail=str(("rn1 ", randomnumber1)), verbosity=1)
# print ("rn=",randomnumber)
# print ("rn50=",randomnumber50)
# print ("rn501=",randomnumber501)
ourattackscore=int(((ourdef*4)+(ourmid*8)+(ourata*6)+(ourexp/7)+(ourchar/4))/4.5)
oppattackscore=int(((oppdef*4)+(oppmid*8)+(oppata*6)+(oppexp/7)+(oppchar/4))/4.5)
ourdefscore=int(((ourgk*4)+(ourdef*8)+(ourmid*4)+(ourata*2)+(ourexp/7)+(ourchar/4))/4.5)
oppdefscore=int(((oppgk*4)+(oppdef*8)+(oppmid*4)+(oppata*2)+(oppexp/7)+(oppchar/4))/4.5)
print ("Our Def Team score",ourdefscore)
print ("Our Ata Team score",ourattackscore)
print ("The Def Opposition Team score",oppdefscore)
print ("The Ata Opposition Team score",oppattackscore)
print ("\n")
#print ("\nLets go play a game")
# our goals tally
ourcomaprescore=0
ourgoals=0
ourcomparescore=int(ourattackscore-oppdefscore)
if ourcomparescore > 50:
if randomnumber1 < 2:
ourgoals=("5")
elif randomnumber1 < 4:
ourgoals=("4")
elif randomnumber1 <= 7:
ourgoals=("3")
elif randomnumber1 <= 8:
ourgoals=("2")
else:
if randomnumber >5:
ourgoals=("1")
else:
ourgoals=("0")
elif ourcomparescore > 25:
if randomnumber1 <= 4:
ourgoals=("4")
elif randomnumber1 <= 7:
ourgoals=("3")
elif randomnumber1 < 10:
ourgoals=("2")
else:
if randomnumber >3:
ourgoals=("1")
else:
ourgoals=("0")
elif ourcomparescore > 10:
if randomnumber1 <= 6:
ourgoals=("3")
elif randomnumber1 < 9:
ourgoals=("2")
else:
if randomnumber >6:
ourgoals=("1")
else:
ourgoals=("0")
else:
if randomnumber50 <= 1:
ourgoals=("3")
elif randomnumber50 <= 4:
ourgoals=("2")
elif randomnumber50 <= 7:
ourgoals=("1")
else:
ourgoals=("0")
# opposition goals tally
oppcomaprescore=0
oppgoals=0
oppcomparescore=int(oppattackscore-ourdefscore)
if oppcomparescore > 50:
if randomnumber < 2:
oppgoals=("5")
elif randomnumber < 4:
oppgoals=("4")
elif randomnumber <= 6:
oppgoals=("3")
elif randomnumber <= 8:
oppgoals=("2")
else:
if randomnumber50 > 5:
ourgoals=("1")
else:
ourgoals=("0")
elif oppcomparescore > 25:
if randomnumber <= 7:
oppgoals=("3")
elif randomnumber < 10:
oppgoals=("2")
else:
if randomnumber50 > 5:
ourgoals=("1")
else:
ourgoals=("0")
elif oppcomparescore > 10:
if randomnumber <= 4:
oppgoals=("3")
elif randomnumber < 8:
oppgoals=("2")
else:
if randomnumber50 > 5:
ourgoals=("1")
else:
ourgoals=("0")
else:
if randomnumber501 <= 1:
oppgoals=("3")
elif randomnumber501 <= 4:
oppgoals=("2")
elif randomnumber501 <= 7:
oppgoals=("1")
else:
oppgoals=("0")
return ourgoals,oppgoals