code-challenge-nasa-rover

This is just a simple java exercise:

  • mars rovers need to be navigated by textfiles.
  • The world is represented as grid with x,y coords.
  • Terms to use are N = north, E = north, S = south, W = west, L = turn left, R = turn right, M = move one field in grid.

The requirements are:

  • The application must run
  • There must be a way to supply the application with the input data via text file
  • evidence that the solution is complete by, as a minimum, indicating that it works correctly against the supplied test data
  • Implement the application in a production ready manner
  • Use no other framework as a native language. You might use 1 framework for testing.

You can build the solution by:

gradlew assemble

And then run it by for example:

java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar
java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar -help
java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar .\src\test\resources\TestInput_valid_1
java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar .\src\test\resources\TestInput_fail_collision_r1_into_r2
....

this would lead to outputs like this:

java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar
Usage: java -jar RoverCli.jar , more details by java -jar RoverCli.jar -help

java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar -help
Usage: java -jar RoverCli.jar 
File format:
..........

java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar .\src\test\resources\TestInput_valid_1
rover end positions:
Rover 1 position:1 3 N
Rover 2 position:5 1 E

java -jar build\libs\rover-cli-1.0-SNAPSHOT.jar .\src\test\resources\TestInput_fail_collision_r1_into_r2
your data is not valid (Rover 1 collision with Rover 2 at (3,3)).
Your input file in correct, but the execution of the movements would lead to possible damage.

unit tests (see src/test/java) can be run and reports generated by:

gradlew test jacocoTestReport

report:

  • html test report can be found under build\reports\tests\test\index.html
  • code coverage report at build\reports\jacoco\test\html\index.html