[Eva] waves.py: звёзды → очки (max_points_for_wave, wave_medal)
This commit is contained in:
+9
-13
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user