Update Elo rating based on game outcome. actual: 1.0 for win, 0.5 for draw, 0.0 for loss k: K-factor, typically 32 for regular players, 16 for masters
(*, current_rating: float, expected_score: float, actual_score: float, k: float = 32)
| 22 | |
| 23 | |
| 24 | def update_elo(*, current_rating: float, expected_score: float, actual_score: float, k: float = 32) -> float: |
| 25 | """ |
| 26 | Update Elo rating based on game outcome. |
| 27 | |
| 28 | actual: 1.0 for win, 0.5 for draw, 0.0 for loss |
| 29 | k: K-factor, typically 32 for regular players, 16 for masters |
| 30 | """ |
| 31 | return current_rating + k * (actual_score - expected_score) |
| 32 | |
| 33 | |
| 34 | # Modeling limitation, draw probability probably usually depends on score difference |
no outgoing calls
no test coverage detected