Advertisement
pacho_the_python

Untitled

Jun 29th, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. from collections import defaultdict
  2.  
  3. players = input().split(", ")
  4.  
  5. size = 6
  6. board = []
  7.  
  8. for _ in range(size):
  9.     current_row = input().split()
  10.     board.append(current_row)
  11.  
  12. condition = defaultdict(bool)
  13. while True:
  14.  
  15.     player = players[0]
  16.     row, col = eval(input())
  17.     if condition[player] == True:
  18.         condition[player] = False
  19.         players.pop(0)
  20.         players.append(player)
  21.         continue
  22.     if board[row][col] == "E":
  23.         print(f"{player} found the Exit and wins the game!")
  24.         break
  25.     if board[row][col] == "T":
  26.         print(f"{player} is out of the game! The winner is {players[1]}.")
  27.         break
  28.     if board[row][col] == "W":
  29.         print(f"{player} hits a wall and needs to rest.")
  30.         condition[player] = True
  31.  
  32.     players.pop(0)
  33.     players.append(player)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement