Last active
April 15, 2022 17:32
-
-
Save harshildarji/772b2c687064c3f0f185a9b4ec0495e7 to your computer and use it in GitHub Desktop.
Shadows of the Knight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codingame.com/ide/puzzle/shadows-of-the-knight-episode-1 | |
import sys | |
import math | |
w, h = [int(i) for i in input().split()] | |
n = int(input()) | |
x0, y0 = [int(i) for i in input().split()] | |
L, R, T, B = 0, w-1, 0, h-1 | |
# game loop | |
while True: | |
bomb_dir = input() | |
bomb_dir_tupple = { | |
"U": (L, R, T, y0-1), | |
"UR": (x0+1, R, T, y0-1), | |
"R": (x0+1, R, T, B), | |
"DR": (x0+1, R, y0+1, B), | |
"D": (L, R, y0+1, B), | |
"DL": (L, x0-1, y0+1, B), | |
"L": (L, x0-1, T, B), | |
"UL": (L, x0-1, T, y0-1) | |
} | |
L, R, T, B = bomb_dir_tupple[bomb_dir] | |
x0, y0 = int((L+R)/2), int((T+B)/2) | |
print(x0, y0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment