Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. def MoveCalc(Official_x, Official_y):#I know... it's lame but I don't care ;)
  5. print(Official_x, file=sys.stderr)
  6. print(Official_y, file=sys.stderr)
  7. global Movement
  8. global Lame
  9. Lame = Official_y
  10. list_Total = [Official_x, Lame]
  11. Pos_List = []
  12.  
  13. for i in range(len(list_Total)):
  14. Pos_List.append(list_Total[i] * list_Total[i])
  15.  
  16. if Pos_List[0] != Pos_List[1]:
  17.  
  18. MaxValue = max(Pos_List)
  19.  
  20. for i in range(len(Pos_List)):
  21. if MaxValue == Pos_List[i]:
  22. ID = i
  23. break
  24.  
  25. if ID == 0:
  26. if Official_x > 0:
  27. Movement = "W"
  28. Official_x = Official_x - 1
  29. Lame = Official_x
  30. return Lame
  31.  
  32. elif Official_x < 0:
  33. Movement = "E"
  34. Official_x = Official_x + 1
  35. print(Official_x)
  36. return Official_x
  37.  
  38. if ID == 1:
  39. if Lame > 0:
  40. Movement = "N"
  41. Lame = Lame - 1
  42. return Lame
  43.  
  44. elif Lame < 0:
  45. Movement = "S"
  46. Official_y = Official_y + 1
  47. print(Official_y)
  48. return Official_y
  49. else:
  50.  
  51. if Official_y > 0 and Official_x > 0:
  52. Movement = "NW"
  53.  
  54. elif Official_y < 0 and Official_x < 0:
  55. Movement = "SE"
  56.  
  57. elif Official_y < 0 and Official_x > 0:
  58. Movement = "SW"
  59.  
  60. elif Official_y > 0 and Official_x < 0:
  61. Movement = "NE"
  62.  
  63. # Auto-generated code below aims at helping you parse
  64. # the standard input according to the problem statement.
  65. # ---
  66. # Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders.
  67.  
  68. # light_x: the X position of the light of power
  69. # light_y: the Y position of the light of power
  70. # initial_tx: Thor's starting X position
  71. # initial_ty: Thor's starting Y position
  72. light_x = 5
  73. light_y = 3
  74. initial_tx = 23
  75. initial_ty = 34
  76. Official_x = initial_tx - light_x
  77. Official_y = initial_ty - light_y
  78.  
  79. # game loop
  80. print(light_x, light_y, initial_tx, initial_ty, file=sys.stderr)
  81. while True:
  82.  
  83. # Write an action using print
  84. # To debug: print("Debug messages...", file=sys.stderr)
  85.  
  86.  
  87. # A single line providing the move to be made: N NE E SE S SW W or NW
  88. MoveCalc(Official_x, Official_y)
  89. Official_y = Lame
  90. print(Lame)
  91. print(Official_x, Official_y, file=sys.stderr)
  92. print(Movement)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement