diff --git a/projet.basket.py b/projet.basket.py deleted file mode 100644 index e69de29..0000000 diff --git a/projet_basket_erika_clara.py b/projet_basket_erika_clara.py new file mode 100644 index 0000000..da60c2a --- /dev/null +++ b/projet_basket_erika_clara.py @@ -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) \ No newline at end of file diff --git a/thonny pour projet.py b/thonny pour projet.py deleted file mode 100644 index ad06354..0000000 --- a/thonny pour projet.py +++ /dev/null @@ -1,13 +0,0 @@ -def reussite("joueur", "action"): - - - - - - -def points("x","y"): - - - - -def totalPoints("joueur"): \ No newline at end of file