public static IList <RoverCommand> GetRoverCommands(string commandInstruction)
        {
            IList <RoverCommand> roverCommands = new List <RoverCommand>();

            char[] commands = commandInstruction.ToCharArray();
            foreach (char command in commands)
            {
                roverCommands.Add(RoverCommandUtility.ParseCommand(command));
            }
            return(roverCommands);
        }
示例#2
0
        private static void SendCommandsToRovers()
        {
            DisplayCommand("Send commands to rovers");
            MarsRoverInstructions roverCommand;

            for (int indexer = 0; indexer < command.NumberOfRovers; indexer++)
            {
                roverCommand = new MarsRoverInstructions();
                roverCommand.RoverPosition       = new MarsRoverParser(Console.ReadLine());
                roverCommand.CommandInstructions = RoverCommandUtility.GetRoverCommands(Console.ReadLine());
                command.AddMarsRoverInstructions(roverCommand);
            }
        }