(scores_dict)
| 48 | |
| 49 | |
| 50 | def update_ratings_for_round(scores_dict): |
| 51 | ordered, ranks = scores_to_ranks(scores_dict) |
| 52 | |
| 53 | # Convert to the Rating objects, preserving team order |
| 54 | team_ratings = [[ratings[name]] for name, _ in ordered] |
| 55 | |
| 56 | # ranks vector matches the order of `teams` |
| 57 | ranks_vec = [ranks[name] for name, _ in ordered] |
| 58 | |
| 59 | # Update using TrueSkill (one multi-player game) |
| 60 | new_team_ratings = ts.rate(team_ratings, ranks=ranks_vec) |
| 61 | |
| 62 | # Write back |
| 63 | for (name, _), new_rating in zip(ordered, new_team_ratings): |
| 64 | ratings[name] = new_rating[0] |
| 65 | |
| 66 | |
| 67 | def conservative_score(r): |
no test coverage detected