Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.76 KB | None | 0 0
  1. import random
  2. import time
  3. import sys
  4.  
  5.  
  6. NUMBER_OF_OPEN_SPACES = 2
  7. OPEN_SPACE_1 = ['gauche']
  8. OPEN_SPACE_2 = ['droite']
  9.  
  10. def main():
  11.  
  12.     number_of_players = int(input("Combien de personnes participent? "))
  13.  
  14.     people_per_room = number_of_players // NUMBER_OF_OPEN_SPACES
  15.     people_left_to_affect = number_of_players % NUMBER_OF_OPEN_SPACES
  16.  
  17.     affectations =    (OPEN_SPACE_1 * people_per_room) \
  18.                     + (OPEN_SPACE_2 * people_per_room) \
  19.                     + (OPEN_SPACE_2 * people_left_to_affect)
  20.  
  21.     random.shuffle(affectations)
  22.  
  23.     for affectation in affectations:
  24.         input("Presse une touche de clavier pour lancer la roue ")
  25.         print_loading_animation()
  26.         print("\nYou've been affected to: \n {}".format(ASCII_RESULTS.get(affectation)))
  27.         print('-'*20)
  28.  
  29. def print_loading_animation():
  30.  
  31.     for i in range(ANIMATION_LENGHT):
  32.         time.sleep(0.1)
  33.         sys.stdout.write("\r" + ANIMATION[i % len(ANIMATION)])
  34.         sys.stdout.flush()    
  35.  
  36. ANIMATION_LENGHT = random.randrange(20,80)
  37.  
  38. ANIMATION = "|/-\\"
  39.  
  40. ASCII_RESULTS = {
  41.  'gauche':
  42.     '''
  43.   __  _____                  _          
  44.  / / |  __ \               | |          
  45. / /  | |  \/ __ _ _   _  ___| |__   ___  
  46. < <   | | __ / _` | | | |/ __| '_ \ / _ \
  47. \ \ | |_\ \ (_| | |_| | (__| | | |  __/
  48.  \_\ \____/\__,_|\__,_|\___|_| |_|\___|
  49.                                          
  50.    ''',
  51.  'droite':
  52.     '''
  53. ______           _ _        __  
  54. |  _  \        (_) |       \ \
  55. | | | |_ __ ___  _| |_ ___   \ \
  56. | | | | '__/ _ \| | __/ _ \  > >
  57. | |/ /| | | (_) | | ||  __/  / /
  58. |___/ |_|  \___/|_|\__\___| /_/  
  59.                                                                  
  60.    '''}
  61.  
  62. if __name__ == "__main__":
  63.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement