Question: 1. Problem Description. It's now time for the final game. In this game, the remaining player is placed in an m x n grid-shaped maze.



1. Problem Description. It's now time for the final game. In this game, the remaining player is placed in an m x n grid-shaped maze. A cell in the maze can either contain only one of the player or an obstacle. The player is allowed to move in the four directions up, down, left and right given that the cell he will be moving to does not contain an obstacle. Your task is to use the discussed search algorithms in class to output a valid path for the player from his starting position to a given destination position. 2. Deliverables. You are required to submit one Java file named FinalGame.java containing the following two methods. a) public static String bfs (String grid) that implements breadth-first search to solve the problem. b) public static String dfs (String grid) that implements depth-first search to solve the problem. Both methods take a String representing the grid formatted as follows: m, n; rowStart, col Start;017, 02C, ..., OKT, OkC; row End, col End where: m, n represent the dimensions of the grid. m is the total number of rows and n is the total number of columns. row Start, col End is the row number and column number respectively of the star- ting position of the player. 0;r and 0;c represent the row and column number of the position of obstacle i for all 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
