mmishanchyk

Retake Exam - 14 April 2021 (problem2)

Jun 10th, 2021 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.40 KB | None | 0 0
  1. players = input().split(", ")
  2. counter = 0
  3. points_to_win = 501
  4. matrix = []
  5. for row in range(7):
  6.     matrix.append([el for el in input().split()])
  7.  
  8. target = input()
  9.  
  10. while target:
  11.     for player in players:
  12.         coordinates = target.split(", ")
  13.         row1 = int((coordinates[0])[-1])
  14.         col1 = int((coordinates[1])[0])
  15.         if row1 and col1 in range(7):
  16.             counter += 1
  17.             points = int(matrix[row1][0]) + int(matrix[row1][6]) + int(matrix[0][col1]) + int(matrix[6][col1])
  18.             if matrix[row1][col1] == "T":
  19.                 points_to_win -= (points * 3)
  20.                 if points_to_win <= 0:
  21.                     print(f"{player} won the game with {counter} throws!")
  22.                     break
  23.                 break
  24.             elif matrix[row1][col1] == "D":
  25.                 points_to_win -= (points * 2)
  26.                 if points_to_win <= 0:
  27.                     print(f"{player} won the game with {counter} throws!")
  28.                     break
  29.                 break
  30.             elif matrix[row1][col1] == "B":
  31.                 print(f"{player} won the game with {counter} throws!")
  32.                 break
  33.             else:
  34.                 points_to_win -= int(matrix[row1][col1])
  35.                 if points_to_win <= 0:
  36.                     print(f"{player} won the game with {counter} throws!")
  37.                     break
  38.                 break
  39.     target = input()
Add Comment
Please, Sign In to add comment