From 39a0844fd4f5299c2de55349b575bfb69a7e9fe9 Mon Sep 17 00:00:00 2001 From: Ziangzzz Date: Tue, 24 Sep 2024 16:12:40 +0000 Subject: [PATCH] Complete darts.py --- darts/darts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/darts/darts.py b/darts/darts.py index 4ba1b3b..ebdd610 100644 --- a/darts/darts.py +++ b/darts/darts.py @@ -1,2 +1,17 @@ +import math def score(x, y): + # Calculate the distance of the dart from the center (0, 0) + distance = math.sqrt(x**2 + y**2) + + # Determine the score based on the distance + if distance > 10: + return 0 # Outside the target + elif distance > 5: + return 1 # Outer circle + elif distance > 1: + return 5 # Middle circle + else: + return 10 # Inner circle + + pass