Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- * ---
- * Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders.
- **/
- class Player
- {
- static void Main(string[] args)
- {
- string[] inputs = Console.ReadLine().Split(' ');
- int LX = int.Parse(inputs[0]); // the X position of the light of power
- int LY = int.Parse(inputs[1]); // the Y position of the light of power
- int TX = int.Parse(inputs[2]); // Thor's starting X position
- int TY = int.Parse(inputs[3]); // Thor's starting Y position
- char[] dir_name = new char[4] {'N', 'E', 'S', 'W'};
- // game loop
- while (true)
- {
- int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
- //Console.WriteLine("SE"); // A single line providing the move to be made: N NE E SE S SW W or NW
- if(LY == TY && LX > TX) Console.WriteLine("E");
- else if (LY == TY && LX < TX) Console.WriteLine("W");
- else if (LY > TY && LX == TX) Console.WriteLine("S");
- else if (LY < TY && LX == TX) Console.WriteLine("N");
- else if (LY > TY && LX > TX)
- {
- Console.WriteLine("SE");
- TY++;
- TX++;
- }
- else if (LY > TY && LX < TX)
- {
- Console.WriteLine("SW");
- TY++;
- TX--;
- }
- else if (LY < TY && LX > TX)
- {
- Console.WriteLine("NE");
- TY--;
- TX++;
- }
- else if (LY < TY && LX < TX)
- {
- Console.WriteLine("NW");
- TY--;
- TX--;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement