|
@ -11,25 +11,18 @@ def reussite(joueur, action): |
|
|
nb_reussite_action += 1 |
|
|
nb_reussite_action += 1 |
|
|
return nb_action, nb_reussite_action |
|
|
return nb_action, nb_reussite_action |
|
|
|
|
|
|
|
|
def points(x, y): |
|
|
def points(x, y): |
|
|
with open("stats.txt","r") as stats : |
|
|
if x**2+(y-300)**2 <= 62500 or (x-1000)**2+(y-300)**2 <= 62500: |
|
|
for ligne in stats: #pour le 1er demi-cercle de centre(0;300) |
|
|
return 2 |
|
|
if x**2+y**2<=(x-0)**2+(y-300)**2: |
|
|
else: |
|
|
print(2) |
|
|
return 3 |
|
|
else: |
|
|
|
|
|
print(3) |
|
|
|
|
|
for ligne in stats: #pour le 2ème demi-cercle de centre(1000;300) |
|
|
|
|
|
if x**2+y**2<=(x-1000)**2+(y-300)**2: |
|
|
|
|
|
print(2) |
|
|
|
|
|
else: |
|
|
|
|
|
print(3) |
|
|
|
|
|
|
|
|
|
|
|
def totalPoints(joueur): |
|
|
def totalPoints(joueur): |
|
|
#théoriquement ça fonctionne mais on ne puet pas le tester tout de suite. |
|
|
|
|
|
with open('stats.txt', 'r') as stats: |
|
|
with open('stats.txt', 'r') as stats: |
|
|
nb_total_points = 0 |
|
|
nb_total_points = 0 |
|
|
for ligne in stats: |
|
|
for ligne in stats: |
|
|
ligne = ligne.strip().split(' ') |
|
|
ligne = ligne.strip().split(' ') |
|
|
coord_x, coord_y = int(ligne[3]), int(ligne[4]) |
|
|
if ligne[0] == joueur: |
|
|
nb_total_points += points(coord_x, coord_y) |
|
|
coord_x, coord_y = int(ligne[2]), int(ligne[3]) |
|
|
|
|
|
nb_total_points += points(coord_x, coord_y) |
|
|
return nb_total_points |
|
|
return nb_total_points |