Question: Coursework Description: Sliding puzzles In this coursework, you are supposed to use path finding to solve a type of puzzle that occurs in many video
Coursework Description: Sliding puzzles In this coursework, you are supposed to use path finding to solve a type of puzzle that occurs in many video games. The basic version that we will be dealing with is this: .....0...S ....0..... 0.....0..0 ...0....0. .F......0. .0........ .......0.. .0.0..0..0 0......... .00.....0. The player starts at the location labelled S and wants to reach the finish, labelled F. Each turn they choose one of the four cardinal directions to move. However, except for S and F the floor is covered in frictionless ice, so they will keep sliding in the chosen direction until they hit the wall surrounding the area, or one of the rocks (labelled 0). For example, starting in the map given above: .....0...@ ....0..... 0.....0..0 ...0....0. .F......0. .0........ .......0.. .0.0..0..0 0......... .00.....0. the player (@) moving left would end up here: .....0@..S ....0..... 0.....0..0 ...0....0. .F......0. .0........ .......0.. .0.0..0..0 0......... .00.....0. So we are dealing with the problem of finding a path from S to F, but the reachability relation between points is not the usual one. Tasks to be performed: Task 1 (10 marks). Set up a project (Java or C++)Choose and implement a data structure which can represent maps such as the one in the example. It must provide the necessary infrastructure for finding a shortest path from the start to the finish.Add a simple parser which can read a map like the one in the example from an input file. It needs to determine the width and height and the locations of the start and finish square as well as the rocks. The structure of the files will look like in the example, i.e., use ./0/S/F for empty (ice) squares, rocks, the start and the finish. Your parser should be able to handle all input files which have this format. We will provide benchmark examples for your performance analysis, but you may also want to create some yourself to test your implementation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
