示例#1
0
        private static void ExecuteCommandsFrom(string path)
        {
            var toyRobot  = new ToyRobot();
            var simulator = new Simulator(toyRobot);

            using (var file = new StreamReader(path))
            {
                string command;
                while ((command = file.ReadLine()) != null)
                {
                    Console.WriteLine("Executing command: " + command);
                    simulator.Execute(command);
                }
            }
        }