Home > MartianRobots

MartianRobots

MartianRobots is a project mainly written in ..., it's free.

Solution for the Martian Robots problem

Martian Robots The Problem
The surface of Mars can be modelled by a rectangular grid around which robots are able to move according to instructions provided from Earth. You are to write a program that determines each sequence of robot positions and reports the final position of the robot.
A robot position consists of a grid coordinate (a pair of integers: x-coordinate followed by y-coordinate) and an orientation (N, S, E, W for north, south, east, and west).
the robot turns left 90 degrees and remains on the current grid point.
the robot moves forward one grid point in the direction of the current orientation and maintains the same orientation.


Each robot is processed sequentially, i.e., finishes executing the robot instructions before the next robot begins execution.
The maximum value for any coordinate is 50.
All instruction strings will be less than 100 characters in length.
The Output

Sample Input 5 3 1 1 E RFRFRFRF 3 2 N FRRFLLFFRRFLL 0 3 W LLFFFLFLFL Sample Output 1 1 E 3 3 N LOST 2 3 S

Previous:Ror3