diff --git a/Projet_Basket.py b/Projet_Basket.py new file mode 100644 index 0000000..5d321c4 --- /dev/null +++ b/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 \ No newline at end of file