Last active
May 22, 2022 21:13
-
-
Save sayotte/78c98e084d44440db91b7758271be16a to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python3 | |
from collections import namedtuple | |
# Input is a CSV with these columns: | |
# name: string, Discord name | |
# availability: integer, scale of 3 (active daily) to 0 (borderline no-show) | |
# region: string, one of apac, est, eu, pst | |
# impact: integer, scale of 3 (effective, deadly callers) to 0 (non-pvper) | |
# I've kept the name in the first column for readability, but ordering of the | |
# fields in the tuple is important so we re-order on import (leftmost field is | |
# more impactful to sorting than rightmost). | |
Draftee = namedtuple('Draftee', ['availability', 'region', 'impact', 'name']) | |
draftees = [] | |
with open('draftlist.csv', 'r') as infile: | |
for line in infile.readlines(): | |
f = line.rstrip('\n').split(',') | |
draftees.append(Draftee(f[1], f[2], f[3], f[0])) # note fields reordered | |
sortedDraftees = sorted(draftees, reverse=True) | |
print('Draft order:') | |
for draftee in sortedDraftees: | |
print('\t', draftee) | |
# Prefix any of these lines with a '#' to remove the corresponding team from | |
# the draft entirely. This turns the line into a "comment" which the Python | |
# interpreter will completely ignore, as if it doesn't exist. Likewise you | |
# can un-comment by removing a leading '#', so that it includes the line. | |
teams = { | |
'CouncileOfMuppets':[], | |
'Manwax':[], | |
# 'SalamiLords':[], | |
'TrueButtheads':[], | |
} | |
while True: | |
if len(sortedDraftees) == 0: | |
break | |
for teamName in teams.keys(): | |
if len(sortedDraftees) == 0: | |
break | |
teams[teamName].append(sortedDraftees.pop(0)) | |
print('\nTeams:') | |
for teamName in sorted(teams.keys()): | |
print(teamName) | |
for draftee in teams[teamName]: | |
print('\t%s' % draftee.__repr__()) |
This file contains 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
Unternoober | 2 | est | 1 | |
---|---|---|---|---|
cava | 3 | apac | 2 | |
merlin | 3 | eu | 3 | |
Leeloo | 3 | est | 3 | |
BGradeActor | 2 | apac | 2 | |
Jill_Stihl | 1 | est | 2 | |
delstrudo | 2 | est | 3 | |
Buga | 2 | est | 3 | |
Ron | 2 | pst | 2 | |
Bloke | 2 | eu | 1 | |
TheDarkOne | 1 | eu | 1 |
This file contains 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
Draft order: | |
Draftee(availability='3', region='eu', impact='3', name='merlin') | |
Draftee(availability='3', region='est', impact='3', name='Leeloo') | |
Draftee(availability='3', region='apac', impact='2', name='cava') | |
Draftee(availability='2', region='pst', impact='2', name='Ron') | |
Draftee(availability='2', region='eu', impact='1', name='Bloke') | |
Draftee(availability='2', region='est', impact='3', name='delstrudo') | |
Draftee(availability='2', region='est', impact='3', name='Buga') | |
Draftee(availability='2', region='est', impact='1', name='Unternoober') | |
Draftee(availability='2', region='apac', impact='2', name='BGradeActor') | |
Draftee(availability='1', region='eu', impact='1', name='TheDarkOne') | |
Draftee(availability='1', region='est', impact='2', name='Jill_Stihl') | |
Teams: | |
CouncileOfMuppets | |
Draftee(availability='3', region='eu', impact='3', name='merlin') | |
Draftee(availability='2', region='eu', impact='1', name='Bloke') | |
Draftee(availability='2', region='apac', impact='2', name='BGradeActor') | |
Manwax | |
Draftee(availability='3', region='est', impact='3', name='Leeloo') | |
Draftee(availability='2', region='est', impact='3', name='delstrudo') | |
Draftee(availability='1', region='eu', impact='1', name='TheDarkOne') | |
SalamiLords | |
Draftee(availability='3', region='apac', impact='2', name='cava') | |
Draftee(availability='2', region='est', impact='3', name='Buga') | |
Draftee(availability='1', region='est', impact='2', name='Jill_Stihl') | |
TrueButtheads | |
Draftee(availability='2', region='pst', impact='2', name='Ron') | |
Draftee(availability='2', region='est', impact='1', name='Unternoober') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment