mathias.millet
7 months ago
1 changed files with 31 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||||
|
def reussite(joueur, action): |
||||
|
with open('stats.txt', 'r') as f: |
||||
|
lines = f.readlines() |
||||
|
tentatives = 0 |
||||
|
reussites = 0 |
||||
|
for line in lines: |
||||
|
data = line.split() |
||||
|
if data[0] == joueur and data[1] == action: |
||||
|
tentatives += 1 |
||||
|
if int(data[3]) == 2: |
||||
|
reussites += 1 |
||||
|
return tentatives, reussites |
||||
|
def points(x, y): |
||||
|
centre_gauche = (0, 300) |
||||
|
centre_droit = (1000, 300) |
||||
|
rayon = 500 |
||||
|
if (x**2 + (y-centre_gauche[1])**2) <= rayon**2: |
||||
|
return 2 |
||||
|
elif (x**2 + (y-centre_droit[1])**2) <= rayon**2: |
||||
|
return 2 |
||||
|
else: |
||||
|
return 3 |
||||
|
def totalPoints(joueur): |
||||
|
with open('stats.txt', 'r') as f: |
||||
|
lines = f.readlines() |
||||
|
total = 0 |
||||
|
for line in lines: |
||||
|
data = line.split() |
||||
|
if data[0] == joueur: |
||||
|
total += int(data[3]) |
||||
|
return total |
Loading…
Reference in new issue