Question
You must implement your program in Java. Your program should read in a map file that specifies the map in the following format. The file
You must implement your program in Java. Your program should read in a map file that specifies the map in the following format. The file name should be able to be specified on the command line. The first line has the dimensions of the map, the second line has the coordinates of the starting location (row column), the third line has the coordinates of the goal location. After that is the specification of the map, which consists of digits between 0 and 5, separated by spaces. These numbers represent the movement cost for moving to a given space on the grid. The number 0 is a special case and is considered impassable terrain. The numbers 1-5 are the number of turns required to move to the given square, with 1 being the lowest cost and 5 being the highest. There is no cost for moving to the starting location. The following is an example of the map format.
5 7
1 2
2 4 2 1 4 5 2
0 1 2 3 5 3 1
2 0 4 4 1 2 4
2 5 5 3 2 0 1
4 3 3 2 1 0 1
You will implement and compare three of the search algorithms.
- Breadth-first search
- Iterative deepening search
- A* search
For each of the three algorithms, print out the following information to the console:
- The cost of the path found
- The number of nodes expanded
- The maximum number of nodes held in memory
- The runtime of the algorithm in milliseconds
- The path as a sequence of coordinates (row, col), (row col), , (row, col)
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