Created
August 13, 2018 16:32
-
-
Save waprin/71f8c9848ceffcd297626cd860e4cd25 to your computer and use it in GitHub Desktop.
analyze opponents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('------------Opponents---------------------') | |
hero_wins = collections.defaultdict(int) | |
hero_totals = collections.defaultdict(int) | |
hero_matches = collections.defaultdict(list) | |
for match in wisp_matches: | |
for hero in match.opponent_picks: | |
hero_totals[hero] += 1 | |
if not match.liquid_win: | |
hero_wins[hero] += 1 | |
hero_matches[hero].append(match.match) | |
win_percent = collections.defaultdict(float) | |
for k, v in hero_wins.items(): | |
win_percent[k] = (v/hero_totals[k]) | |
sorted_percent = collections.OrderedDict(sorted(win_percent.items(), key=itemgetter(1), reverse=True)) | |
for k, v in sorted_percent.items(): | |
print('Hero {} has won {} out of {} games against Liquid IO for a win percent of {} (matches {})'.format( | |
k, hero_wins[k], hero_totals[k], v, hero_matches[k])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment