public static void Main(String[] args) { MarsProxy proxy = new MarsProxy(); proxy.SetMapObstacle(2, 2); while (true) { Console.WriteLine("Please input command"); String command = Console.ReadLine(); if (command == "q") break; Message msg = proxy.MoveRover(command); if (msg.IsOperationSucceeded()) { Console.WriteLine("The rover is now at: " + "X: " + msg.GetX() + " Y: " + msg.GetY()); } else { Console.WriteLine("There's obstacle at: " + "X: " + msg.GetX() + " Y: " + msg.GetY()); } //if (proxy.MoveRover(command)) //{ // Console.WriteLine("Succeeded!"); //} //else //{ // Console.WriteLine("Failed!"); //} bool[,] boolMap = proxy.GetMap(); //int[] pos = proxy.GetRoverPos(); // List<int[]> trace = proxy.GetTrace(); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { if (boolMap[i, j]) Console.WriteLine("Obstacle at: " + "X:" + i + " " + "Y:" + j); } } //Console.WriteLine("The rover is now at: " + "X:" + pos[0] + " " + "Y:" + pos[1]); Console.WriteLine("The rover is facing:" + proxy.GetDirection().ToString()); Console.WriteLine(); } Console.ReadLine(); }
public void Setup_Proxy() { _proxy = new MarsProxy(); }