Przejdź do głównej zawartości


Wyświetlanie postów z sierpień, 2013

Code Kata: A rover

Another game-like exercise. A rover moves over a board with X and Y dimensions. Some places on the board are filled with stones and this is where the rover cannot move onto. Your task is to implement the rover and the board with the following requirements and restrictions:
the rover understands your commands (e.g. from command line) of the form:forward - moves one step forwardleft, right - makes 90 degrees turn left or rightif the rover gets the forward command and there is a stone in front of it, it just ignores it; you can optionally print a message to signal thatthe rover does not have the knowledge of the terrain - it keeps a reference to a board [object] which actually knows where the stones are and tells the rover whether a given move is possible or notthe rover should not be allowed to move outside of the board Although it will probably be fun to test this with command line, you are encouraged to use TDD as you go.