introduce obstacles term
This commit is contained in:
parent
a8e2d506fa
commit
04d2448863
|
@ -1,5 +1,6 @@
|
||||||
package cat.hack3.codingtests.marsrover.core;
|
package cat.hack3.codingtests.marsrover.core;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +23,7 @@ public class MarsMap {
|
||||||
|
|
||||||
private final MapIncrementalPositionResolver positionResolver;
|
private final MapIncrementalPositionResolver positionResolver;
|
||||||
|
|
||||||
public MarsMap(int height, int width, Coordinates startingCoordinates) {
|
public MarsMap(int height, int width, Coordinates startingCoordinates, List<Coordinates>... obstaclesLocalizations) {
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
currentPosition = startingCoordinates;
|
currentPosition = startingCoordinates;
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cat.hack3.codingtests.marsrover.core;
|
||||||
|
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cat.hack3.codingtests.marsrover.core.Direction.SOUTH;
|
||||||
|
|
||||||
|
public class MarsRoverWithObstaclesTest {
|
||||||
|
|
||||||
|
private MarsRover rover;
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void setUp() {
|
||||||
|
int mapWidth = 10;
|
||||||
|
int mapHeight = 10;
|
||||||
|
int latitudeStartingPoint = 2;
|
||||||
|
int longitudeStartingPoint = 3;
|
||||||
|
var startingCoordinates = Coordinates.of(latitudeStartingPoint, longitudeStartingPoint);
|
||||||
|
List<Coordinates> obstaclesLocalizations = List.of(
|
||||||
|
Coordinates.of(3, 3),
|
||||||
|
Coordinates.of(5, 5),
|
||||||
|
Coordinates.of(7, 7),
|
||||||
|
Coordinates.of(9, 9),
|
||||||
|
Coordinates.of(10, 10)
|
||||||
|
);
|
||||||
|
var marsMap = new MarsMap(mapHeight, mapWidth, startingCoordinates, obstaclesLocalizations);
|
||||||
|
rover = new MarsRover(marsMap, SOUTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue