def play_round(self, track: Track): """Plays a round in the tournament for a track. :param track: The track that is playing this round. """ if track.round > MAX_ROUNDS: print('This track is already complete') return print('Playing the %s\'s track' % track.name) winners = HashTable() winner = None matches = List() track.update_previous_winners() if self.previous is not None and next_bool( 'Should we seed the round for you?', True): if track.round == 1: self.seed_automatic_first(track, matches) else: self.seed_automatic_next(track, matches) else: input_type = next_input_type('How should data be entered?') if input_type == FILE: matches = self.seed_file(track) else: self.seed_manual(track, matches) # Run each match. for match in matches: # Find the winner and add them to the next batch. winner, winner_score, loser, loser_score = match.run( track.winning_score, track.remaining) winners.insert(winner.player.name, winner) winner: TournamentStats = winner loser: TournamentStats = loser # Update the winner profile. winner.win() winner.add_score(winner_score, loser_score) # Update the loser profile. loser.loss() loser.add_score(loser_score, winner_score) apply_multiplier(track.name, winner, loser_score) self.update_points(loser, track) if track.round == MAX_ROUNDS: print('Tournament %s successfully complete for the %s\'s track' % (self.type.name, track.name)) print('Winner for the final round: %s' % winner.player.name) track.round += 1 self.update_points(winner, track) self.print_scoreboard(track.name) return print('Winners for round %d:' % track.round) for name, stats in winners: print('- %s' % name) track.remaining = winners track.round += 1