You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
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)
|