private static void ExecuteAllCommands(Robot robot) { string path = @"commands.txt"; string[] commands = File.ReadAllLines(path); foreach (string command in commands) { robot.ExecuteCommand(command); } }
private Robot RunMission(Mission mission) { // We will run the commands with a copy of the mission's robot, so the original is untouched. Robot robot = new Robot(mission.Robot); // mission.Commands is a string where each character will be interpreted by the robot as a command. foreach (char c in mission.Commands) { robot.ExecuteCommand(c.ToString(), config.Grid); } return robot; }