public void MoveFFRFF_Blocked()
        {
            //Arrange
            var start     = new Point();
            var grid      = new Point(10, 10);
            var obstacles = new ReadOnlyCollection <Point>(new List <Point>
            {
                new Point(0, 2)
            });
            var       terrain     = new PlanetaryTerrain(grid, obstacles);
            var       orientation = OrientationEnum.North;
            IMovement rover       = new PlutoRover(terrain, start, orientation);

            const string moveCommand      = "FFRFF";
            ILocation    expectedLocation = new LocationBlocked("", 0, 1, orientation);

            //Act
            ILocation newLocation = rover.Move(moveCommand);

            //Assert
            Assert.That(newLocation, Is.Not.Null);
            Assert.That(newLocation.X, Is.EqualTo(expectedLocation.X));
            Assert.That(newLocation.Y, Is.EqualTo(expectedLocation.Y));
            Assert.That(newLocation.Orientation, Is.EqualTo(expectedLocation.Orientation));
        }
Exemple #2
0
        public void TurnRight_OrientatedNorth()
        {
            //Arrange
            var       start       = new Point();
            var       grid        = new Point(10, 10);
            var       terrain     = new PlanetaryTerrain(grid, new ImmutableArray <Point>());
            var       orientation = OrientationEnum.North;
            IMovement rover       = new PlutoRover(terrain, start, orientation);

            const string moveCommand      = Movement.TurnRight;
            ILocation    expectedLocation = new Location(start.X, start.Y, OrientationEnum.East);

            //Act
            ILocation newLocation = rover.Move(moveCommand);

            //Assert
            Assert.That(newLocation, Is.Not.Null);
            Assert.That(newLocation.X, Is.EqualTo(expectedLocation.X));
            Assert.That(newLocation.Y, Is.EqualTo(expectedLocation.Y));
            Assert.That(newLocation.Orientation, Is.EqualTo(expectedLocation.Orientation));
        }
Exemple #3
0
        public void MoveForward_StartAtGridBoundary_OrientatedEast_WrapAround()
        {
            //Arrange
            var       grid        = new Point(10, 10);
            var       start       = new Point(grid.X, PlutoRover.ROOT_Y);
            var       terrain     = new PlanetaryTerrain(grid, new ImmutableArray <Point>());
            var       orientation = OrientationEnum.East;
            IMovement rover       = new PlutoRover(terrain, start, orientation);

            const string moveCommand      = Movement.Forwards;
            ILocation    expectedLocation = new Location(PlutoRover.ROOT_X, start.Y, orientation);

            //Act
            ILocation newLocation = rover.Move(moveCommand);

            //Assert
            Assert.That(newLocation, Is.Not.Null);
            Assert.That(newLocation.X, Is.EqualTo(expectedLocation.X));
            Assert.That(newLocation.Y, Is.EqualTo(expectedLocation.Y));
            Assert.That(newLocation.Orientation, Is.EqualTo(expectedLocation.Orientation));
        }
        public void MoveFFRFF_RequirementsExample()
        {
            //Arrange
            var       start       = new Point();
            var       grid        = new Point(100, 100);
            var       terrain     = new PlanetaryTerrain(grid, new ImmutableArray <Point>());
            var       orientation = OrientationEnum.North;
            IMovement rover       = new PlutoRover(terrain, start, orientation);

            const string moveCommand      = "FFRFF";
            ILocation    expectedLocation = new Location(2, 2, OrientationEnum.East);

            //Act
            ILocation newLocation = rover.Move(moveCommand);

            //Assert
            Assert.That(newLocation, Is.Not.Null);
            Assert.That(newLocation.X, Is.EqualTo(expectedLocation.X));
            Assert.That(newLocation.Y, Is.EqualTo(expectedLocation.Y));
            Assert.That(newLocation.Orientation, Is.EqualTo(expectedLocation.Orientation));
        }
Exemple #5
0
 private static void CreateHydrosphere()
 {
     PlanetaryTerrain.CreateHydrosphere(10.02f);
 }
Exemple #6
0
 private static void CreateAtmosphere()
 {
     PlanetaryTerrain.CreateAtmosphere(1.1f);
 }
Exemple #7
0
 private static void CreatePlanet()
 {
     PlanetaryTerrain.CreatePlanet();
 }