The application is a simulation of a toy robot moving on a square tabletop, of dimensions 5 units x 5 units.
toy-robot-simulator was developed using Ruby 2.0.0, but it has also been tested on Ruby 1.9.3.
bin/toy_robot_simulator [options]
-w, --width width Table width
-h, --height height Table height
-f, --file filename File with instructions - 1 per line
-g, --graphics Enable graphical robot navigation mode
--help Displays Help
PLACE will put the toy robot on the table in position X,Y and facing NORTH, SOUTH, EAST or WEST.
MOVE will move the toy robot one unit forward in the direction it is currently facing.
LEFT will rotate the robot 90 degrees anti-clockwise without changing the position of the robot.
RIGHT will rotate the robot 90 degrees clockwise without changing the position of the robot.
REPORT will announce the X,Y and F of the robot.
GFX ON/OFF will respectively enable or disable the graphical simulation mode.
HELP will show the help menu - shortcut: h
QUIT will terminate the simulation - shortcut: q
- The first valid command to the robot is a PLACE command, after that, any sequence of commands may be issued, in any order, including another PLACE command. The simulation discards all commands in the sequence until a valid PLACE command has been executed.
- The origin (0,0) is considered to be the SOUTH WEST most corner.
- There are no other obstructions on the table surface.
- The robot is free to roam around the surface of the table, but must be prevented from falling to destruction.
- Rspec tests are available under spec/
- Test input files are available under data/ (e.g. bin/toy_robot_simulator -f data/t1_data.txt)