The MOST Amazing game to hit consoles near you.
Robot Output: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ < _ _ _ _ _ _ _ _ input 'q' to quit or input a command for your robot PLACE (0-4 X-coor), (0-4 Y-coor), (north, south, east, west Direction): place robot on coordinates facing Direction Erroneous input will be ignored MOVE: go one direction forward LEFT: turn left RIGHT: turn right REPORT: display your location and direction
PLACE (0-4 X-coor), (0-4 Y-coor), (north, south, east, west Direction): place robot on coordinates facing Direction Erroneous input will be ignored
- valid examples: "
place 1,3,east" and "
- invalid examples: "
place 3,east", "
- this will be ignored
MOVE: go one direction forward
- example: "
LEFT: turn left
- example: "
RIGHT: turn right
To try it out:
- copy or fork the repo
ruby app/terminal_manager.rbfrom the root folder
see: APPLICATION INSTALLATION INSTRUCTIONS for more details
- This application was developed on: Mac OS X 10.10.5
SYSTEM DEPENDENCIES & CONFIGURATION
- ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
APPLICATION INSTALLATION INSTRUCTIONS
To install application:
From your terminal
git clone https://github.com/RoadBytes/ToyRobot.git
From the root folder
The application is designed to reads strings from $stdin and prints out the current state of a board to $stdout.
- You can input several commands at once by using enter
place 1,2,north left move right move move <enter>
or just one at a time:
place 1,2,south <enter> left <enter> move <enter> right <enter> move <enter> move <enter>
- the state of the board is output with every
input passed into the program are expected to be separated by spaces
output will be printed on the terminal screen with the robot represented by:
v, <, >, ^depending on where it's facing
For Gracious Code reviewers
REQUIREMENTS OF THE ASSIGNMENT
- 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, but must be prevented from falling to destruction. Any movement that would result in the robot falling from the table must be prevented, however further valid movement commands must still be allowed.
Create an application that can read in commands of the following form
PLACE X,Y,F MOVE LEFT RIGHT REPORT
- PLACE will put the toy robot on the table in position X,Y and facing NORTH, SOUTH, EAST or WEST.
- 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 another PLACE command. The application should discard all commands in the sequence until a valid PLACE command has been executed.
- MOVE will move the toy robot one unit forward in the direction it is currently facing.
- LEFT and RIGHT will rotate the robot 90 degrees in the specified direction without changing the position of the robot.
- REPORT will announce the X,Y and orientation of the robot.
- A robot that is not on the table can choose to ignore the MOVE, LEFT, RIGHT and REPORT commands.
- Provide test data to exercise the application.
The toy robot must not fall off the table during movement. This also includes the initial placement of the toy robot. Any move that would cause the robot to fall must be ignored.
Example Input and Output:
a) PLACE 0,0,NORTH MOVE REPORT Output: 0,1,NORTH
b) PLACE 0,0,NORTH LEFT REPORT Output: 0,0,WEST
c) PLACE 1,2,EAST MOVE MOVE LEFT MOVE REPORT Output: 3,3,NORTH
The source files, the test data and any test code.