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 lightX = int.Parse(inputs[0]); // the X position of the light of power
- int lightY = int.Parse(inputs[1]); // the Y position of the light of power
- int initialTx = int.Parse(inputs[2]); // Thor's starting X position 3
- int initialTy = int.Parse(inputs[3]); // Thor's starting Y position 6
- string move = null;
- // game loop
- while (true)
- {
- int[] xy = {initialTx, initialTy};
- int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- if(((xy[0]<lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "SE";
- initialTx++;
- initialTy++;
- }
- else if(((xy[0]==lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "S";
- initialTy++;
- }
- else if(((xy[0]>lightX) && (xy[1]<lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "SW";
- initialTx--;
- initialTy++;
- }
- else if(((xy[0]>lightX) && (xy[1]==lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "W";
- initialTx--;
- }
- else if(((xy[0]>lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "NW";
- initialTx--;
- initialTy--;
- }
- else if(((xy[0]==lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "N";
- initialTy--;
- }
- else if(((xy[0]<lightX) && (xy[1]>lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "NE";
- initialTx++;
- initialTy++;
- }
- else if(((xy[0]>lightX) && (xy[1]==lightY)) && ((initialTx < 40 )&&(initialTy < 18)) && ((initialTx >= 0)&&(initialTy >= 0))){
- move = "E";
- initialTx--;
- }
- // A single line providing the move to be made: N NE E SE S SW W or NW
- Console.WriteLine(move);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement