コード例 #1
0
ファイル: Robot.cs プロジェクト: brian-artz/RobotCleaner
 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
ファイル: Program.cs プロジェクト: brian-artz/RobotCleaner
        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();
        }