The application is a simulation of a toy robot moving on a square tabletop, of dimensions 5 units x 5 units. There are no other obstructions on the table surface. The robot is free to roam around the surface of the table.
- PLACE will put the toy robot on the table in position
X
,Y
and facingNORTH
,SOUTH
,EAST
orWEST
. - The origin (0,0) can be considered to be the
SOUTH WEST
most corner. - The first valid command to the robot is a
PLACE
command, after that, any sequence of commands may be issued, in any order, including anotherPLACE
command. MOVE
will move the toy robot one unit forward in the direction it is currently facing.LEFT
andRIGHT
will rotate the robot 90 degrees in the specified direction without changing the position of the robot.REPORT
will announce thex
,y
andfacing
of the robot.- Input can be from a file or from standard input.
git clone https://github.com/xamut/toy_robot.git
cd toy_robot
bin/setup
bin/toy_robot help start
bin/toy_robot start # Start toy robot with default settings
bin/toy_robot start -f FILE # Start toy robot with default settings and read commands from file
bin/toy_robot start -f examples/commands_1.txt # Start toy robot with default settings and read commands from file
bin/toy_robot start -l 10 -w 10 # Start toy robot with length of 10 units and width of 10 units