Created
April 29, 2019 00:27
-
-
Save caseyrollins/f24dacf57bdb891135fd18043331a52b 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
import math | |
import random | |
CHARACTERS = [ | |
'Brienne', | |
'Bronn', | |
'Beric Dondarrion', | |
'Dolorous Edd', | |
'Gendry', | |
'Ghost', | |
'Gilly', | |
'Euron Greyjoy', | |
'Theon Greyjoy', | |
'Yara Greyjoy', | |
'Greyworm', | |
'The Hound', | |
'Cersei Lannister', | |
'Jaime Lannister', | |
'Tyrion Lannister', | |
'Melisandre', | |
'Missandei', | |
'Lyanna Mormont', | |
'Jorah Mormont', | |
'The Mountain', | |
'Podrick Payne', | |
'Qyburn', | |
'Little Sam', | |
'Davos Seaworth', | |
'Jon Snow', | |
'Arya Stark', | |
'Bran Stark', | |
'Sansa Stark', | |
'Daenerys Targaryen', | |
'Samwell Tarly', | |
'Tormund', | |
'Lord Varys', | |
] | |
players = input("Who's playing? Separate names with commas.\n") | |
while ',' not in players: | |
players = input("Sorry, there must be at least two players.\nWho's playing? Separate names with commas.\n") | |
players = players.split(',') | |
chars_per_player = math.floor(len(CHARACTERS) / len(players)) | |
if chars_per_player < 5: | |
chars_per_player = 5 | |
if chars_per_player > 8: | |
chars_per_player = 8 | |
play_with_duplicates = input('Would you like to play with or without duplicates?\n') | |
while play_with_duplicates not in ['with', 'without']: | |
play_with_duplicates = input('Would you like to play with or without duplicates?\n') | |
play_with_duplicates = True if play_with_duplicates == 'with' else False | |
if len(players) >= 6 and not play_with_duplicates: | |
print('Sorry, you have too many players to play without duplicates. Continuing with duplicates...') | |
play_with_duplicates = True | |
if play_with_duplicates: | |
for player in players: | |
indices = random.sample(range(0, len(CHARACTERS)), chars_per_player) | |
chosen_characters = [CHARACTERS[i] for i in indices] | |
print('{}: {}'.format(player, chosen_characters)) | |
else: | |
start_index = 0 | |
end_index = chars_per_player | |
for player in players: | |
chosen_chars = CHARACTERS[start_index:end_index] | |
start_index += chars_per_player | |
end_index += chars_per_player | |
print('{}: {}'.format(player, chosen_chars)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment