maux_robot

Maux version of a Toy Robot Simulator in Ruby

Description

Task

This is an application that can read in commands of the following form:

PLACE X,Y,F
MOVE
LEFT
RIGHT
REPORT [csv|json]
VERBOSE

Constraints

The toy robot does 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 is ignored.

Installation

gem install maux_robot

Execution

Example Input and Output:

# Example a
echo "PLACE 0,0,NORTH
MOVE
REPORT" | maux_robot
# Output: 0,1,NORTH
# Example b
echo "PLACE 0,0,NORTH
LEFT
REPORT" | maux_robot
# Output: 0,0,WEST
# Example c
echo "PLACE 1,2,EAST
MOVE
MOVE
LEFT
MOVE
REPORT" | maux_robot
# Output: 3,3,NORTH
# Example d
cat script_file | maux_robot

Acknowledgement

The Toy Robot Challenge was originally formulated by Jon Eaves

Author

Mauricio Vieira (mauriciovieira) + mauriciovieira.net + twitter.com/mauriciovieira + github.com/mauriciovieira