This question deals with graphs and path-finding within them. You will write a program which… 1 answer below »

This assignment deals with graphs and path-finding within them. You will write a program which allows the user to enter multiple levels of a text-based map, consisting of a ‘start’, an ‘exit’, ‘walls’, and ‘floors’. The letter S represents the start. E is the exit. O (the letter ‘oh’) represents a ‘floor’ (meaning a path you can follow). X is a wall (meaning a block you cannot pass). Your program will accept this ASCII-based map from Standard Input (System.in), and convert it into a graph. It is up to you whether you wish to use an adjacency matrix or adjacency lists (linked or array-based). However, this step is not optional, and those are your only two options. Ideally, your program will allow the user to find the ‘fastest’ path through the maze. In this context, ‘fastest’ means the fewest number of steps possible to get from the start to the exit, without crossing a wall. Note: You may only move North, South, East, West, Up, or Down (diagonal travel is not allowed). If no valid path exists, your program should say so. You may assume ‘sane’ input, and that a start and exit are present (though there might not be a path connecting them). The maps do not ‘wrap’ (i.e. you can’t exit the left edge to appear on the right edge), and you may not assume that a floor will have a boundary of walls. Specifically, the input will be as follows: An integer for the width of the map (W) An integer for the height (length) of the map (H) An integer for the depth (number of layers) of the map (D) D×H lines of W characters (from {X,O,S,E}), terminated with newlines For D layers, first the (H) lines of the top layer will be entered, then the lines of the second-highest, etc. In place of any line of W characters, it is legal to include an entirely blank line (as such, any line will have W characters followed by a n, or consist solely of a n. Your code must be able to ignore such blank lines, but may never rely on their presence; an input might not have any blank lines at all). You will then write a small report on the algorithms/methodologies you used. Include a quick description of how you translated the ASCII maze into a graph, and how you performed any path-finding/estimation algorithms. It will probably be approximately two pages (unless you’re concise, in which case probably a page).

Don't use plagiarized sources. Get Your Custom Essay on
This question deals with graphs and path-finding within them. You will write a program which… 1 answer below »
Just from $13/Page
Order Essay

Attachments:

Leave a Reply

Your email address will not be published.

*

*

*