From 6e02303ea8f1f5d4002ba04778576e96e46708c9 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Tue, 13 Oct 2026 11:33:02 +0000 Subject: [PATCH] =?UTF-8?q?[Eva]=20waves.py:=20=D0=B7=D0=B2=D1=91=D0=B7?= =?UTF-8?q?=D0=B4=D1=8B=20=E2=86=92=20=D0=BE=D1=87=D0=BA=D0=B8=20(max=5Fpo?= =?UTF-8?q?ints=5Ffor=5Fwave,=20wave=5Fmedal)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/waves.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/services/waves.py b/services/waves.py index 1be744e..984a96c 100644 --- a/services/waves.py +++ b/services/waves.py @@ -45,22 +45,18 @@ def grid_size_for(global_level: int) -> int: return sizes[0] if pos <= HALF_WAVE else sizes[1] -def max_stars_for_wave() -> int: - """Максимум звёзд за волну (10 уровней × 5 звёзд).""" - return WAVE_SIZE * 5 +def max_points_for_wave() -> int: + """Максимум очков за волну: 10 уровней × 110 = 1100.""" + return 10 * 110 -def wave_medal(stars_earned: int) -> str: - """ - Медаль волны по доле звёзд. - Пороги: gold >= 90%, silver >= 70%, bronze >= 50%, else 'none'. - """ - total = max_stars_for_wave() - pct = stars_earned / total if total > 0 else 0 - if pct >= 0.90: +def wave_medal(points: int, max_points: int) -> str: + """Медаль за волну: gold ≥90%, silver ≥70%, bronze ≥50%, иначе none.""" + pct = 100 * points / max_points if max_points > 0 else 0 + if pct >= 90: return "gold" - if pct >= 0.70: + if pct >= 70: return "silver" - if pct >= 0.50: + if pct >= 50: return "bronze" return "none"