Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- black = {'N':'W','W':'S','S':'E','E':'N'}
- white = {'N':'E','E':'S','S':'W','W':'N'}
- w, h = [int(i) for i in input().split()]
- x,y = [int(i) for i in input().split()]
- ant = input()
- t = int(input())
- grid = []
- for i in range(h):
- grid.append(list(input()))
- print(ant, file = sys.stderr)
- for i in range(t):
- ant = white[ant] if grid[y][x] == "." else black[ant]
- print(ant, grid[y][x],file=sys.stderr)
- grid[y][x] = "#" if grid[y][x] == "." else "."
- if ant == "N": y -= 1
- elif ant == "S": y +=1
- elif ant == "E": x -=1
- elif ant == "W": x +=1
- for i in grid:
- print(''.join(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement