Exemplo n.º 1
0
 public RobotManager(RobotClient client, int robotId)
 {
     Client = client;
     RobotId = robotId;
     Map = new RobotMap();
 }
Exemplo n.º 2
0
 public static void ConsoleClient(RobotClient c)
 {
     Console.Write("robot id: ");
     var robotId = int.Parse(Console.ReadLine());
     while (true)
     {
         var key = Console.ReadKey();
         RobotAction action = RobotAction.Wait;
         switch (key.Key)
         {
             case ConsoleKey.UpArrow:
                 action = RobotAction.Go;
                 break;
             case ConsoleKey.RightArrow:
                 action = RobotAction.Right;
                 break;
             case ConsoleKey.LeftArrow:
                 action = RobotAction.Left;
                 break;
             case ConsoleKey.Escape:
                 return;
             case ConsoleKey.C:
                 ConsoleClient(c);
                 break;
         }
         Console.Clear();
         Console.Write(robotId + ": " + action.ToString());
         var r = c.Execute(robotId, action);
         Console.WriteLine(r.Result);
         Console.WriteLine(" " + (char)r.FrontMapTile);
         Console.WriteLine((char)r.LeftMapTile + " " + (char)r.RightMapTile);
     }
 }