Advertisement
mbratanov

02. Exit Founder

Oct 20th, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. from collections import deque
  2.  
  3. players = deque(input().split(", "))
  4. matrix_size = 6
  5.  
  6. resting = {players[0]: False, players[-1]: False}
  7.  
  8. matrix = []
  9. for _ in range(matrix_size):
  10.     row_data = input().split()
  11.     matrix.append(row_data)
  12. while True:
  13.     command = input()
  14.     row, col = eval(command)
  15.    
  16.     current_player = players[0]
  17.     other_player = players[-1]
  18.     if resting[current_player]:
  19.         resting[current_player] = False
  20.         players.rotate(-1)
  21.         continue
  22.  
  23.     if matrix[row][col] == "E":
  24.         print(f"{current_player} found the Exit and wins the game!")
  25.         break
  26.     elif matrix[row][col] == "T":
  27.         print(f"{current_player} is out of the game! The winner is {other_player}.")
  28.         break
  29.     elif matrix[row][col] == "W":
  30.         resting[current_player] = True
  31.         print(f"{current_player} hits a wall and needs to rest.")
  32.     players.rotate(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement