Advertisement
xTheEc0

CodinGame.com // Power of Thor // Easy

Oct 22nd, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.IO;
  4. using System.Text;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7.  
  8. /**
  9.  * Auto-generated code below aims at helping you parse
  10.  * the standard input according to the problem statement.
  11.  * ---
  12.  * Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders.
  13.  **/
  14. class Player
  15. {
  16.     static void Main(string[] args)
  17.     {
  18.         string[] inputs = Console.ReadLine().Split(' ');
  19.         int LX = int.Parse(inputs[0]); // the X position of the light of power
  20.         int LY = int.Parse(inputs[1]); // the Y position of the light of power
  21.         int TX = int.Parse(inputs[2]); // Thor's starting X position
  22.         int TY = int.Parse(inputs[3]); // Thor's starting Y position
  23.    
  24.         char[] dir_name = new char[4] {'N', 'E', 'S', 'W'};
  25.         // game loop
  26.         while (true)
  27.         {
  28.             int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
  29.             //Console.WriteLine("SE"); // A single line providing the move to be made: N NE E SE S SW W or NW
  30.            
  31.             if(LY == TY && LX > TX) Console.WriteLine("E");
  32.             else if (LY == TY && LX < TX) Console.WriteLine("W");
  33.             else if (LY > TY && LX == TX) Console.WriteLine("S");
  34.             else if (LY < TY && LX == TX) Console.WriteLine("N");
  35.             else if (LY > TY && LX > TX)
  36.             {
  37.                 Console.WriteLine("SE");
  38.                 TY++;
  39.                 TX++;
  40.             }
  41.             else if (LY > TY && LX < TX)
  42.             {
  43.                 Console.WriteLine("SW");
  44.                 TY++;
  45.                 TX--;
  46.             }
  47.             else if (LY < TY && LX > TX)
  48.             {
  49.                 Console.WriteLine("NE");
  50.                 TY--;
  51.                 TX++;
  52.             }
  53.             else if (LY < TY && LX < TX)
  54.             {
  55.                 Console.WriteLine("NW");
  56.                 TY--;
  57.                 TX--;
  58.             }
  59.            
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement