Created
January 22, 2019 15:49
-
-
Save Noxville/85d14b7e0999df7f413b74c7ee712aea to your computer and use it in GitHub Desktop.
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
slots_available = 12 | |
total_points_available = 5 * 13475.0 # minor + major | |
threshold = total_points_available / slots_available | |
# Fill in current points | |
tp = { | |
'Virtus.pro': 7050, | |
'Team Secret': 5100, | |
'Evil Geniuses': 2250, | |
'PSG.LGD': 1800, | |
'Ninjas in Pyjamas': 1420, | |
'EHOME': 900, | |
'TNC Predator': 870, | |
'Fnatic': 600, | |
'Vici Gaming': 600, | |
'J.Storm': 270, | |
'Alliance': 225, | |
'Chaos Esports Club 10': 225, | |
'Forward Gaming': 225, | |
'Team Aster': 150, | |
'Thunder Predator': 150, | |
'Gambit Esports': 148, | |
'Test123 3': 120, | |
'Natus Vincere': 100, | |
'Keen Gaming': 90, | |
'Team Liquid': 90, | |
'Tigers': 76.8, | |
'The Pango': 45, | |
'Infamous': 44.8, | |
'Royal Never Give Up': 43.2, | |
'TEAM TEAM': 40, | |
'OG': 24, | |
'Vega Squadron': 24, | |
'compLexity Gaming': 20.48, | |
'BOOM ID': 20, | |
'Playmakers Esports': 20, | |
'The Final Tribe': 20, | |
'ROOONS': 8.192 | |
} | |
def sum_top_x(d, x): | |
return sum([_[1] for _ in sorted(d.items(), key=lambda x: x[1], reverse=True)[:x]]) | |
def solve(slots_available, points_left, teams, threshold, done): | |
print("{}Threshold = {} [{} left]".format('Final ' if done else '', threshold, slots_available)) | |
if done: return | |
qualified = 0 | |
for t, p in teams.items(): | |
if p >= threshold: | |
print("> {} has qualified".format(t)) | |
teams.pop(t) | |
qualified += 1 | |
# update slots & threshold | |
slots_available -= qualified | |
threshold = (0.0 + sum_top_x(teams, slots_available + 1) + points_left) / (slots_available + 1) | |
solve(slots_available, points_left, teams, threshold, qualified > 0) | |
solve(slots_available, 5565 + (3 * 13475.0), tp, threshold, False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment