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"