Advertisement
Szczepan86

Zadanie z Thorem

Oct 20th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. # Auto-generated code below aims at helping you parse
  5. # the standard input according to the problem statement.
  6. # ---
  7. # Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders.
  8.  
  9. # light_x: the X position of the light of power
  10. # light_y: the Y position of the light of power
  11. # initial_tx: Thor's starting X position
  12. # initial_ty: Thor's starting Y position
  13. light_x, light_y, initial_tx, initial_ty = [int(i) for i in raw_input().split()]
  14.  
  15. # game loop
  16. while True:
  17.     remaining_turns = int(raw_input())  # The remaining amount of turns Thor can move. Do not remove this line.
  18.  
  19.     # Write an action using print
  20.     # To debug: print >> sys.stderr, "Debug messages..."
  21.    
  22.     kierunek = ""
  23.    
  24.     if light_y > initial_ty:
  25.         kierunek = "S"
  26.         initial_ty = initial_ty + 1
  27.     if light_y < initial_ty:
  28.         kierunek = "N"
  29.         initial_ty = initial_ty - 1
  30.    
  31.     if light_x > initial_tx:
  32.         kierunek = kierunek + "E"
  33.         initial_tx = initial_tx + 1
  34.     if light_x < initial_tx:
  35.         kierunek = kierunek + "W"
  36.         initial_tx = initial_tx - 1
  37.    
  38.     print(kierunek)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement