Browse Source

ajout projet basket

master
mathias.millet 7 months ago
parent
commit
b95259a83d
  1. 31
      Projet_Basket.py

31
Projet_Basket.py

@ -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…
Cancel
Save