Browse Source

ajout du projet basket

master
massiniss.brahimi 6 months ago
commit
1be2c83c52
  1. 50
      BASKET.py
  2. 97
      donee_basket.txt

50
BASKET.py

@ -0,0 +1,50 @@
import re
def reussite(joueur, action):
Tentatives = 0
reussite_sur_laction = 0
with open(r"Basket gagadya.txt", 'r') as f:
f.readline()
for ligne in f:
ligne = ligne.strip()
info = re.split(r' |-', ligne)
#Je sors "re.split(r' |-', ligne) d'un forum car j'ai
if info[0] == joueur and info[1] == action:
Tentatives += 1
if info[2] in ["reussi", "reu", "faite"]:
reussite_sur_laction += 1
print(f"Tentatives : {Tentatives}")
print(f"Réussites : {reussite_sur_laction}")
return Tentatives, reussite_sur_laction
def points(x, y):
niqat = 0
centre1 = (0, 300)
centre2 = (1000, 300)
rayon = 250
dans_cercle1 = (x - centre1[0])**2 + (y - centre1[1])**2 <= rayon**2
dans_cercle2 = (x - centre2[0])**2 + (y - centre2[1])**2 <= rayon**2
if dans_cercle1 or dans_cercle2 :
niqat += 2
else :
niqat += 3
print(f"Les points pour un tir à x={x} et y={y} sont : {niqat}")
return niqat
def totalpoints (joueur):
niqat = 0
with open("Basket gagadya.txt") as f:
f.readline()
for ligne in f:
ligne = ligne.strip()
info = re.split(r' |-', ligne)
if info :
x, y = int(info[3]), int(info[4])
if info[0] == joueur :
if info[2] in ["reussi"] :
niqat += points(x, y)
if info[2] in ["reu"] :
niqat += 1
print(f"Les points pour un lancée franc sont : 1")
print(f"Totals points : {niqat}")
totalpoints ("J2")

97
donee_basket.txt

@ -0,0 +1,97 @@
J2 tir-manque 35 263 0 0
J8 tir-manque 39 308 0 0
J8 tir-reussi 133 148 2 0
J6V tir-reussi 819 375 2 2
J2 tir-reussi 27 283 4 2
J4 faute-subie 33 317 4 2
J4 lancer-rat 181 297 4 2
J4 lancer-rat 182 296 4 2
J4 tir-reussi 25 268 4 4
J2 tir-reussi 48 274 6 4
J2V tir-reussi 973 316 6 6
J2 faute-subie 132 265 6 6
J2 tir-manque 35 280 6 6
J2 tir-manque 44 277 6 6
J1 tir-reussi 174 505 9 6
J8 faute-faite 980 359 9 6
J2 tir-reussi 33 258 11 6
J2 tir-reussi 135 496 13 6
J6V tir-reussi 949 232 13 8
J8 tir-reussi 133 318 15 8
J4 tir-reussi 71 254 15 10
J1V tir-reussi 907 293 15 12
J2 tir-reussi 70 118 17 12
J8 faute-subie 267 313 17 12
J8 faute-faite 304 306 17 12
J3 rebond-def 909 304 17 12
J4 tir-manque 90 263 17 12
J3 lancer-rat 183 307 17 12
J3 lancer-reu 184 296 18 12
J10 faute-faite 857 384 18 12
J6 tir-reussi 30 272 20 12
J2V tir-manque 921 305 20 12
J4 faute-subie 123 237 20 12
J4 tir-manque 40 203 20 12
J4 tir-manque 53 230 20 12
J10 faute-faite 898 319 20 12
J10 faute-faite 837 264 20 12
J2V lancer-reu 818 297 20 13
J2V lancer-rat 813 292 20 13
J4 rebond-def 965 311 20 13
J3 tir-manque 34 279 20 13
J4 tir-reussi 39 279 20 15
J3 tir-manque 159 125 20 15
J8 tir-reussi 101 325 2 0
J6V tir-manque 949 266 2 0
J2 tir-reussi 47 257 4 0
J6 faute-faite 890 260 4 0
J2 tir-reussi 66 267 6 0
J2 ballon-recup 693 282 6 0
J8 tir-manque 64 265 6 0
J6 rebond-def 33 167 6 0
J1 tir-manque 62 251 6 0
J2 tir-reussi 99 45 9 0
J9V tir-reussi 946 256 9 2
J7 tir-manque 41 99 9 2
J1 tir-manque 40 492 9 2
J8 rebond-def 18 317 9 2
J2 tir-manque 41 258 9 2
J1 rebond-def 937 339 9 2
J8 tir-manque 19 329 9 2
J8 tir-manque 48 282 9 2
J7 tir-manque 83 483 9 2
J1 faute-faite 210 327 9 2
J8 rebond-def 970 304 9 2
J2 tir-reussi 49 317 11 2
J6V tir-manque 885 267 11 2
J5V tir-manque 841 204 11 2
J7 tir-manque 120 277 11 2
J8 faute-faite 899 328 11 2
J7V lancer-rat 817 305 11 2
J7V lancer-reu 816 309 11 3
J9 tir-manque 53 331 11 3
J3 rebond-def 53 269 11 3
J3 tir-manque 79 274 11 3
J9 rebond-def 948 293 11 3
J6V tir-manque 901 255 11 3
J3 tir-reussi 38 258 13 3
J3 faute-subie 45 252 13 3
J3 lancer-reu 184 299 14 3
J3 tir-manque 49 266 14 3
J3 tir-reussi 56 264 16 3
J7V tir-manque 918 339 16 3
J4 rebond-def 922 263 16 3
J4 faute-subie 41 312 16 3
J4 lancer-rat 187 301 16 3
J4 lancer-reu 186 297 16 4
J9 tir-reussi 45 272 18 4
J4 ballon-recup 927 283 18 4
J10 tir-reussi 63 326 20 4
J6V tir-manque 917 306 20 4
J3 tir-manque 108 224 20 4
J3 tir-manque 64 249 20 4
J4 tir-reussi 144 462 20 6
J9 faute-faite 579 527 20 6
J9V tir-manque 965 327 20 6
J4 rebond-def 955 306 20 6
J4 tir-reussi 52 255 20 8
Loading…
Cancel
Save