Advertisement
Guest User

Untitled

a guest
Feb 21st, 2021
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.86 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.  
  24.         // game loop
  25.         while (true)
  26.         {
  27.             int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
  28.  
  29.             // Write an action using Console.WriteLine()
  30.             // To debug: Console.Error.WriteLine("Debug messages...");
  31.             int[] xy = {initialTx, initialTy};
  32.             string move;
  33.  
  34.                 if(((xy[0]<lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  35.                     move = "SE";
  36.                 }
  37.                 else if(((xy[0]==lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  38.                     move = "S";
  39.                 }
  40.                 else if(((xy[0]>lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  41.                     move = "SW";
  42.                 }
  43.                 else if(((xy[0]>lightX) && (xy[1]==lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  44.                     move = "W";
  45.                 }
  46.                 else if(((xy[0]>lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  47.                     move = "NW";
  48.                 }
  49.                 else if(((xy[0]==lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  50.                     move = "N";
  51.                 }
  52.                 else if(((xy[0]<lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  53.                     move = "NE";
  54.                 }
  55.                 else(((xy[0]>lightX) && (xy[1]==lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
  56.                     move = "E";
  57.                 }
  58.  
  59.             // A single line providing the move to be made: N NE E SE S SW W or NW
  60.             Console.WriteLine(move);
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement