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; }
/// <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(); }
public Plataeu() { this.commandSplitter = new PlateauCommandSplitter(); }