示例#1
0
 public Robot(CommandSet commandSet, CleaningRecorder recorder)
 {
     this.commandSet = commandSet;
     this.recorder   = recorder;
     this.position   = commandSet.StartingCoords;
     //HashSet should also include starting position to keep accurate account of position's cleaned.
     recorder.CleanPosition(commandSet.StartingCoords);
 }
示例#2
0
        static void Main(string[] args)
        {
            CommandFactory commandFactory = new CommandFactory();

            while (!commandFactory.EndOfInput())
            {
                //gather the instructions
                commandFactory.ParseInput(Console.ReadLine());
            }

            CleaningRecorder recorder      = new CleaningRecorder();
            Robot            cleaningRobot = new Robot(commandFactory.GetCommands(), recorder);

            cleaningRobot.CleanOffice();
            Console.WriteLine(recorder.GetPositionsCleanedResult());
            //Console.ReadLine();
        }