A simple 5x5 table top toy robot simulator.
- Clone the repository.
- Install dependencies with:
npm install
. - Run the robot with example commands
./bin/toy-robot example.txt
.
The robot supports the following commands:
PLACE X,Y,F
: Place the robot on the table top at position X,Y facing F. F is eitherNORTH
,SOUTH
,EAST
orWEST
.MOVE
: Move the robot one unit forward in the direction it is facing.LEFT
: Turn the robot 90 degrees to the left.RIGHT
: Turn the robot 90 degrees to the right.REPORT< 55AF /code>: Report the current position of the robot.
To help see where the robot is ./bin/visualise
can be used. This script makes two assumptions:
- All movements are followed by a
REPORT
command. - If the same position is reported twice then the robot is moved to a new table.
To run the tests you can either run npm test
or npm test -- --watch
to have the tests rerun every time you save a file.