Advertisement
exDotaPro

9_march_2019_4_game_number_wars

Jan 10th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. player_one = input()
  2. player_two = input()
  3.  
  4. winner_is_found = False
  5. winner = ''
  6. winner_points = 0
  7. player_one_points = 0
  8. player_two_points = 0
  9.  
  10. command = input()
  11.  
  12. while command != 'End of game':
  13.  
  14.     card_player_one = int(command)
  15.     card_player_two = int(input())
  16.  
  17.     while card_player_one == card_player_two:
  18.         print('Number wars!')
  19.        
  20.         card_player_one = int(input())
  21.         card_player_two = int(input())
  22.  
  23.         if card_player_one > card_player_two:
  24.             winner = player_one
  25.             winner_points = player_one_points
  26.             winner_is_found = True
  27.            
  28.         elif card_player_two > card_player_one:
  29.             winner = player_two
  30.             winner_points = player_two_points
  31.             winner_is_found = True
  32.  
  33.     if winner_is_found:
  34.         print(f'{winner} is winner with {winner_points} points')
  35.         break
  36.  
  37.     if card_player_one > card_player_two:
  38.         player_one_points += card_player_one - card_player_two
  39.         winner_points = player_one_points
  40.     else:
  41.         player_two_points += card_player_two - card_player_one
  42.         winner_points = player_two_points
  43.  
  44.     command = input()
  45.  
  46.     if command == 'End of game':
  47.         print(f'{player_one} has {player_one_points} points')
  48.         print(f'{player_two} has {player_two_points} points')
  49.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement