This assignment is derived from the original assignment.
Organizations such as Larimer County Search and Rescue are responsible for missing person searches in wilderness areas. They deploy resources such as helicopters, search dogs, and hiking teams to look for missing persons. The next series of assignments will develop a Search and Rescue Simulator. In any search, the Task Force Team Leader must decide how to best deploy available resources, particularly the searchers themselves. The purpose of the Search and Rescue Simulator is to evaluate different strategies for deploying the searchers.
This assignment will simply model the movements of a lost hiker.
A common search pattern is the grid search. The area where the person is believed to be lost is divided into cells, and each cell searched by rescuers. We can model the locations of people in the grid using the coordinates of their current cell. This first assignment develops code simulating the movements of a lost hiker.
In this series of assignments, you will write a program that simulates the movements of a lost hiker, as well as the efforts of the searchers that are deployed to look for the person.
A common programming technique to model location and movement is to employ an array and use the indices as location coordinates. We will use a two-dimensional array (a grid) with indices representing (zero based) north-south and east-west coordinates. Each element, or cell, of the grid represents a potential location in the simulated "world".
int array to store the history of the hiker's random movements (10 sets of x, y coordinates).x and y representing the current location of the hiker. Initialize their values to place the lost hiker in the center of the grid.Declare your function prototype and definition in your main .cpp file.
The movement of a lost hiker is difficult to predict and rarely consistent, so we will model the hiker's movements as a uniform random variable: the probability of the hiker moving to any particular neighboring cell, as well as remaining in the current cell, is equal.
When the loop finishes, report to the console with well labeled and formatted output:
Starting coordinate: (10,10)
Hour 1: (9,10)
Hour 2: (8,10)
Hour 3: (7,10)
Hour 4: (6,10)
Hour 5: (5,10)
Hour 6: (4,10)
Hour 7: (3,10)
Hour 8: (2,10)
Hour 9: (1,10)
Hour 10: (1,10)
Final coordinates: (1, 10)
Assume that the hiker is surrounded by impassable terrain on all sides at a linear distance of 5 from the original starting position. Treat these bounds as edge cases, in which the hiker cannot move outside of these bounds. (Your random movement generator must consider these edge cases when determining a valid movement. See the original assignment for some hints.)