Beispiel #1
0
        private static void ProcessLine(String line, RobotSimulator simulator)
        {
            if (line.ToLower().Equals("exit"))
            {
                Environment.Exit(0);
            }

            if (line.ToLower().Equals(ToyRobot.Engine.Enumeration.Command.REPORT.ToString().ToLower()))
            {
                Console.WriteLine(simulator.ReportOutput());
            }
            else
            {
                simulator.ProcessInput(line);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int            tableSize      = 5;
            RobotSimulator robotSimulator = new RobotSimulator(new Robot(tableSize));

            Console.WriteLine("*************ROBOT SIMULATOR***********\nTABLE SIZE 5x5\nValid Commands:\n " +
                              "\n PLACE X,Y,DIRECTION [Ex: PLACE 0,0,EAST]" +
                              "\n MOVE" +
                              "\n LEFT" +
                              "\n RIGHT" +
                              "\n REPORT");
            while (true)
            {
                Console.WriteLine("\nPlease enter a command:");
                String command = Console.ReadLine();
                Console.WriteLine(robotSimulator.Simulate(command.Trim()));
            }
        }