clara.covin
9 months ago
3 changed files with 50 additions and 13 deletions
@ -0,0 +1,50 @@ |
|||||
|
from math import * |
||||
|
|
||||
|
def reussite(joueur, action): |
||||
|
lst_joueur = [] |
||||
|
lst_action = [] |
||||
|
nbtentives = 0 |
||||
|
nbreussite = 0 |
||||
|
with open ('stats.txt', 'r') as stats: |
||||
|
for ligne in stats : |
||||
|
ligne = ligne.strip() |
||||
|
lst_elements = ligne.split(' ') |
||||
|
joueur = lst_elements[0] |
||||
|
action = lst_elements[1] |
||||
|
lst_joueur.append(joueur) |
||||
|
lst_action.append(action) |
||||
|
action = ligne.split('-') |
||||
|
if action == 'tir-manque' or action == 'tir-reussi' or action == 'lancer-rat' or action == 'lancer-reu': |
||||
|
nbtentatives = nbtentatives + 1 |
||||
|
if action == 'tir-reussi' or action == 'lancer-reu': |
||||
|
nbreussite = nbreussite + 1 |
||||
|
return nbtentives, nbreussite |
||||
|
|
||||
|
def points(x,y): |
||||
|
xA = 0 |
||||
|
yA = 30 |
||||
|
xB = 1000 |
||||
|
yB = yA |
||||
|
if x > 1000 or y > 600 : |
||||
|
print("erreur de saisie") |
||||
|
else : |
||||
|
if sqrt((x-xA)**2+(y-yA)**2) <= 250 or sqrt((x-xB)**2+(y-yB)**2) <= 250 : |
||||
|
return 2 |
||||
|
else : |
||||
|
return 3 |
||||
|
|
||||
|
def totalPoints(joueur): |
||||
|
point = reussite("joueur", action) |
||||
|
for read in table : |
||||
|
if read[0] == joueur and read[1][1] == "reussi" : |
||||
|
point = point+point(int(read[2]), int(read[3])) |
||||
|
return point |
||||
|
with open ('stats.txt', 'r') as stats : |
||||
|
stats = stats.readlines() |
||||
|
table = [] |
||||
|
count = 0 |
||||
|
for line in stats : |
||||
|
table.append(line.split()) |
||||
|
table[count][1] = table[count][1].split("-") |
||||
|
count = count+1 |
||||
|
print(table) |
@ -1,13 +0,0 @@ |
|||||
def reussite("joueur", "action"): |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
def points("x","y"): |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
def totalPoints("joueur"): |
|
Loading…
Reference in new issue