The Java-version of this code is taken from vfarcic/mars-rover-kata-java and converted to a Clojure project. Based on Java Tutorial Through Katas: Mars Rover.
Develop an API that moves a rover around on a grid.
- You are given the initial starting point [x, y] of a rover, the direction (:north, :south, :east, :west) it is facing and the current world.
- The rover receives a string of commands, e.g. "l" (left), "lfl" (left, forward, left).
- Implement commands that turn the rover left / right.
- Implement commands that move the rover forward / backward.
- Implement wrapping from one edge of the grid to another. (planets are spheres after all)
- Implement obstacle detection before each move to a new square.
Description based on: Dallas Hack Club.
Graphical visualization based on stianeikeland/rover-clj
Recommended approach to solve this kata is by using TDD.
The game has a graphical representation. To start it, type lein run
.
To start a REPL and the graphical representation, first start a repl with
lein repl
and then execute in this REPL:
(-main)
Run the tests with lein test
or automatically with lein test-refresh