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.

31 lines
924 B

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