Runs tournament with the players and updates their measured elo.
(self, players: list[Player])
| 82 | self.update_strategy = update_strategy |
| 83 | |
| 84 | def run_tournament(self, players: list[Player]): |
| 85 | """Runs tournament with the players and updates their measured elo.""" |
| 86 | assert len(players) == 2 |
| 87 | results = [] |
| 88 | for _round in range(self.n_rounds): |
| 89 | results.append(self.game.play_game(players)) |
| 90 | if self.update_strategy == "per_round": |
| 91 | self._update_elo_per_round(players, results) |
| 92 | elif self.update_strategy == "per_tournament": |
| 93 | self._update_elo_per_tournament(players, results) |
| 94 | else: |
| 95 | raise ValueError(f"Invalid update strategy: {self.update_strategy}") |
| 96 | |
| 97 | def _update_elo_per_round(self, players: list[Player], results: list[dict[str, int]]): |
| 98 | for result in results: |
no test coverage detected