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.

15 lines
488 B

import math
def points(x, y):
"""Détermine si un tir vaut 2 ou 3 points en fonction de sa position."""
# Centre du demi-cercle : (0, 300) | Rayon : 150 pixels
if x <= 150 and math.sqrt(x**2 + (y - 300)**2) <= 150:
return 2
if x >= 850 and math.sqrt((x - 1000)**2 + (y - 300)**2) <= 150:
return 2
return 3
# Test de la fonction
if __name__ == "__main__":
print(points(50, 300)) # Doit retourner 2
print(points(500, 300)) # Doit retourner 3