The Mars Rovers have created great interest in many fields of study. From a computer programming perspective,
Question:
The Mars Rovers have created great interest in many fields of study. From a computer programming perspective, the rovers provide a unique application of simulation, specialized instruction sets, and remote communications, to name a few.
The mission specialists, located at NASA's JPL (Jet Propulsion Labs), upload a set of commands to the rovers, and then proceed to execute them, based on the recommendations from other mission specialists associated with the Mars rover program. For this assignment, only the motion subsystem of the rover is being considered.
Although the actual Mars rovers have a more extensive instruction set, the following three instructions will be considered:
·Forward – the rover moves 0.25 metre forward, and then stops
·Right – the rover turns 90 degrees to the right, and then stops
·Left – the rover turns 90 degrees to the left, and then stops
The rover's world, for this assignment, will be considered to be a series of tiles arranged in a 1024 by 1024 map. Each tile of the map measures 0.25 metre by 0.25 metre.
Normally, the mission specialist writes the script to permit the rover to move from place to place, avoiding obstacles as required. This is a tedious task, since the instruction set is limited. There must be a better way.
Your task is to design, develop, and test an application that will enable the mission specialist to enter a Cartesian (x,y) starting position, and an ending position. Your application will then instruct the rover to move from the starting position to the end. Dispersed within the 'world' are a series of obstacles. These obstacles may be as small as one tile (a rock for instance), or a series of tiles (a boulder, or crevasse).
The key to this application is that the rover can only see one tile ahead; either straight, left, or right. The rover should move toward the end position, but may encounter these obstacles along the way. The rover, once it encounters an obstacle, should turn, and then attempt to move in another direction.
You are also provided 10,000 battery credits per day. A single battery credit is consumed with each instruction that is executed on the rover.