Question
Write a program (preferably in Python, if not Java) that automatically generates the search map for the robot and then finds the shortest path using
Write a program (preferably in Python, if not Java) that automatically generates the search map for the robot and then finds the shortest path using the Grassfire algorithm.
Here are the steps to generate the search map based on the inputs from the user:
- Step1: divide the search region in grid cells:
User enters the size of the region as the dimensions of the grid. This means user should provide the number of rows and columns. The minimum size should be 8x8.
- Step 2: identify the obstacle cells
Use provides a random number as the percentage of the obstacle cells. This can be any percentage in the range of 10% to 20%. In your program, you can round up the user input to make it an integer number. Based on this number, generate a random list of pairs representing the row and column indices of the obstacle cells.
- Step 3: initialize the starting cell
User enters a random number less than the number of columns which represents a cell in the first row as the starting cell/node.
- Step 4: initialize the destination cell
User provides the index of row and column for the destination node. To this end, the row index should be a random number greater than half of the number of rows (i.e., if the number of rows is 10, the row index for the destination cell should be greater than 5) and the column index is greater than 2/3 of the number of columns (i.e., if the number of columns is 10, the column index for the destination cell should be greater than 6.6 which should be round up to 7).
The program should output the searched map (graphically or in matrix format) and then print the solutions corresponding to the shortest path(s) using Grassfire algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started