コード例 #1
0
        public void move_rover_forwards_and_backwards()
        {
            RoverState initialState = new RoverState { Facing = rover.CurrentState.Facing, X = rover.CurrentState.X, Y = rover.CurrentState.Y };

            rover.ExecuteCommands("FBFBFB");

            Assert.AreEqual(rover.CurrentState.Facing, initialState.Facing);
            Assert.AreEqual(rover.CurrentState.X, initialState.X);
            Assert.AreEqual(rover.CurrentState.Y, initialState.Y);
        }
コード例 #2
0
        public void move_rover_in_a_square()
        {
            RoverState initialState = new RoverState { Facing = rover.CurrentState.Facing, X = rover.CurrentState.X, Y = rover.CurrentState.Y };

            rover.ExecuteCommands("FFRFF");

            Assert.AreEqual(rover.CurrentState.Facing, Facing.East);
            Assert.AreEqual(rover.CurrentState.X, 2);
            Assert.AreEqual(rover.CurrentState.Y, 2);

            rover.ExecuteCommands("RFFRFFR");

            Assert.AreEqual(rover.CurrentState.Facing, initialState.Facing);
            Assert.AreEqual(rover.CurrentState.X, initialState.X);
            Assert.AreEqual(rover.CurrentState.Y, initialState.Y);
        }
コード例 #3
0
 public TurnLeftCommand(RoverState roverState)
     : base(roverState)
 {
 }
コード例 #4
0
ファイル: MoveCommand.cs プロジェクト: vphilomin/MarsRover
 protected MoveCommand(RoverState roverState, INavigator navigator, IObstacleDetector obstacleDetector)
     : base(roverState)
 {
     Navigator = navigator;
     ObstacleDetector = obstacleDetector;
 }
コード例 #5
0
        public void move_rover_with_some_unrecognized_commands()
        {
            RoverState initialState = new RoverState { Facing = rover.CurrentState.Facing, X = rover.CurrentState.X, Y = rover.CurrentState.Y };

            rover.ExecuteCommands("FFQBB");                             //I'm not 100% sure about this terminating behavior; but let's roll with it for now.

            Assert.AreEqual(rover.CurrentState.X, initialState.X);
            Assert.AreNotEqual(rover.CurrentState.Y, initialState.Y);
        }
コード例 #6
0
 public TurnRightCommand(RoverState roverState)
     : base(roverState)
 {
 }
コード例 #7
0
ファイル: GoCommand.cs プロジェクト: vphilomin/MarsRover
 protected GoCommand(RoverState roverState)
 {
     RoverState = roverState;
 }
コード例 #8
0
 public MoveForwardCommand(RoverState roverState, INavigator navigator, IObstacleDetector obstacleDetector)
     : base(roverState, navigator, obstacleDetector)
 {
 }
コード例 #9
0
ファイル: Rover.cs プロジェクト: vphilomin/MarsRover
 public Rover(Position position, Direction direction, IGrid grid)
 {
     RoverState = new RoverState(position, direction);
     _navigator = new Navigator(grid);
     _obstacleDetector = new ObstacleDetector(grid);
 }
コード例 #10
0
 public void setRover(RoverState StateIn)
 {
     throttlePID = new RoverPidController(10, 1e-5F, 1e-5F, 50, 1);
     this.roverState = StateIn;
     altitude = Vector3d.Distance(Vessel.mainBody.position, Vessel.transform.position);
     roverActive = true;
     Vessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, false);
 }