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;
- 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
- int initialTy = int.Parse(inputs[3]); // Thor's starting Y position
- int diffX = initialTx - lightX;
- int diffY = initialTy - lightY;
- // game loop
- while (true) {
- int remainingTurns = int.Parse(Console.ReadLine()); // The remaining amount of turns Thor can move. Do not remove this line.
- string moves = "";
- if (diffY > 0) {
- moves += "N";
- diffY--;
- } else if (diffY < 0) {
- moves += "S";
- diffY++;
- }
- if (diffX > 0) {
- moves += "W";
- diffX--;
- } else if (diffX < 0) {
- moves += "E";
- diffX++;
- }
- Console.WriteLine(moves);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement