/
/
/
1"""Scoring helpers for the Music Quiz provider."""
2
3from __future__ import annotations
4
5
6def calculate_linear_scores(
7 correct_answer_order: list[str], max_points: int = 1000
8) -> dict[str, int]:
9 """
10 Calculate linearly descending scores for correct answers.
11
12 :param correct_answer_order: Player IDs ordered by correct answer time.
13 :param max_points: Points awarded to the first correct answer.
14 """
15 correct_count = len(correct_answer_order)
16 if correct_count == 0:
17 return {}
18 return {
19 player_id: round(max_points * (correct_count - index) / correct_count)
20 for index, player_id in enumerate(correct_answer_order)
21 }
22