Advertisement
Guest User

Untitled

a guest
Feb 21st, 2021
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 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 lightX = int.Parse(inputs[0]); // the X position of the light of power
  20.         int lightY = int.Parse(inputs[1]); // the Y position of the light of power
  21.         int initialTx = int.Parse(inputs[2]); // Thor's starting X position 3
  22.         int initialTy = int.Parse(inputs[3]); // Thor's starting Y position 6
  23.         string move = null;
  24.         int deltaX = initialTx;
  25.  
  26.         // game loop
  27.         while (true)
  28.         {
  29.             int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
  30.  
  31.             // Write an action using Console.WriteLine()
  32.             // To debug: Console.Error.WriteLine("Debug messages...");
  33.             if(deltaX < lightX)
  34.                 deltaX++;
  35.                 move = "E";
  36.             if(deltaX > lightX)
  37.                 deltaX--;
  38.                 move = "W";
  39.                
  40.             // A single line providing the move to be made: N NE E SE S SW W or NW
  41.             Console.WriteLine(move);
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement