@@ -0,0 +1,1370 @@
+def packBounds(xMin, xMax, yMin, yMax):%0A%09return %5B%5BxMin, xMax%5D, %5ByMin, yMax%5D%5D%0A%0Adef unpackBounds(bounds):%0A%09xMin, xMax = bounds%5B0%5D%0A%09yMin, yMax = bounds%5B1%5D%0A%09return %5BxMin, xMax, yMin, yMax%5D%0A%0Adef nextMove(width, height, x, y, direction, bounds):%0A%09xMin, xMax, yMin, yMax = unpackBounds(bounds)%0A%0A%09if direction == %22U%22:%0A%09%09yMax = y%0A%09elif direction == %22UR%22:%0A%09%09xMin = x%0A%09%09yMax = y%0A%09elif direction == %22R%22:%0A%09%09xMin = x%0A%09elif direction == %22DR%22:%0A%09%09xMin = x%0A%09%09yMin = y%0A%09elif direction == %22D%22:%0A%09%09yMin = y%0A%09elif direction == %22DL%22:%0A%09%09xMax = x%0A%09%09yMin = y%0A%09elif direction == %22L%22:%0A%09%09xMax = x%0A%09elif direction == %22UL%22:%0A%09%09yMax = y%0A%09%09xMax = x%0A%0A%09if %22U%22 in direction or %22D%22 in direction:%0A%09%09y = (yMax - yMin) / 2 + yMin%0A%09if %22L%22 in direction or %22R%22 in direction:%0A%09%09x = (xMax - xMin) / 2 + xMin%0A%0A%09return %5Bx, y, packBounds(xMin, xMax, yMin, yMax)%5D%0A%0A# width: width of the building.%0A# height: height of the building.%0Awidth, height = %5Bint(i) for i in raw_input().split()%5D%0AN = int(raw_input()) # maximum number of turns before game over.%0Ax, y = %5Bint(i) for i in raw_input().split()%5D%0A%0AxMin = 0%0AyMin = 0%0AxMax = width%0AyMax = height%0A%0Abounds = packBounds(xMin, xMax, yMin, yMax)%0A%0A# Game loop%0Awhile True:%0A%09# The direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL)%0A%09direction = raw_input()%0A%09x, y, bounds = nextMove(width, height, x, y, direction, bounds)%0A%09print str(x) + %22 %22 + str(y)

Add exercise heat detector