コード例 #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;
        }
コード例 #2
0
ファイル: Commandr.cs プロジェクト: jamesholcomb/Commandr
        /// <summary>
        /// Creates a new instance of <see cref="Commandr.Commandr"/>.
        /// </summary>
        /// <param name="commands">The commands to register</param>
        public Commandr(
        	ICommandSplitter splitter = null,
        	IOutput output = null,
        	IListener listener = null,
            IShutdownBroker shutdownBroker = null,
            ICommandResolver resolver = null
        )
        {
            this.splitter = splitter ?? new DefaultCommandSplitter();
            this.output = output ?? new ConsoleOutput();
            this.listener = listener ?? new ConsoleListener();
            this.shutdownBroker = shutdownBroker ?? new DefaultShutdownBroker();
            this.resolver = new DefaultCommandResolver(this.output);

            this.shouldExit = false;

            this.RegisterDefaultCommands();
        }
コード例 #3
0
ファイル: Plateau.cs プロジェクト: mehmetdemirci/marsrover
 public Plataeu()
 {
     this.commandSplitter = new PlateauCommandSplitter();
 }