예제 #1
0
        public Rover(Plataeu plataeu, string roverStartCommand)
        {
            this.plataeu                = plataeu;
            this.commandSplitter        = new RoverPositionCommandSplitter();
            this.controlCommandSplitter = new RoverControlCommandSplitter();
            this.StartPosition          = commandSplitter.Split(roverStartCommand);

            if (this.IsRoverInPlateau(this.StartPosition.X, this.StartPosition.Y) == false)
            {
                throw new RoverOutsidePlateauException("Rover outside of bounds");
            }

            this.direction       = AvailableDirections.List().Single(x => x.Direction == StartPosition.Direction);
            this.CurrentPosition = StartPosition;
        }