示例#1
0
 def get_player_scores(
         self,
         match_reports: MatchReportCollection) -> Mapping[Player, float]:
     scores: Dict[Player, int] = defaultdict(int)
     stats_by_player: PlayerTable = match_reports.collect_stats()
     for player, stats in stats_by_player.items():
         scores[player] += stats.kills
         scores[player] -= stats.deaths
     return scores
示例#2
0
 def get_player_scores(
         self,
         match_reports: MatchReportCollection) -> Mapping[Player, float]:
     stats_by_player: PlayerTable = match_reports.collect_stats()
     scores = {
         player: stats.total_rounds_played()
         for player, stats in stats_by_player.items()
     }
     return scores
示例#3
0
 def get_player_scores(
         self,
         match_reports: MatchReportCollection) -> Mapping[Player, float]:
     scores: Dict[Player, float] = defaultdict(int)
     stats_by_player: PlayerTable = match_reports.collect_stats()
     for player, stats in stats_by_player.items():
         rounds_played = stats.total_rounds_played()
         if rounds_played:
             rounds_won = stats.rounds_won
             scores[player] = rounds_won / rounds_played
     return scores
示例#4
0
    def get_confidence_in_player_scores(
            self,
            match_reports: MatchReportCollection) -> Mapping[Player, float]:
        """
        Returns a level of confidence in the score returned (a number between 0 and 1).
        Default calculation is 1 if the number of rounds the player was involved in is more than the filter_less_than
        parameter (and 0 otherwise).
        Other scorers may override this value, usually with  the percentage of rounds this player was involved in.
        """
        stats_by_player: PlayerTable = match_reports.collect_stats()

        confidence_table = {}
        for player, stats in stats_by_player.items():
            player_rounds = stats.total_rounds_played()
            confidence_table[
                player] = 1 if player_rounds >= self.filter_treshold else 0
        return confidence_table