Hello I am working on a project for my roommate that involves reading in a text file that has x's and o's. The x's mean a wall and the o's mean an open path.
The maze begins at 0,0 and ends at 15, 15. This makes the graph 15x15.
I was thinking about using Breadth-First Search to accomplish this as I am looking for the SHORTEST PATH to the end.
I have been working on this for 10 hours today and can't think of a way to translate the path into a visible format.
Soxxxxooooooxxxx oooooooooooxoxxo xooooooxxxxoooox xoxxxoxoooooooox xxxoooxoooxxxxox ooooxxxxoooxooox oxoooxoooooxooox oxoooxooooxooooo oxoooxxxxoxoxooo oxoooxooooxxxxxo xxxxoxxxxoxooxoo oooooxoooooooxoo oxooooooxxxxxxoo oxxxxooooxxooooo ooxoooooxoxoxxxx oooooxxxooxooooF
If this is the maze then the S is the start and the F is the finish.
What I was asked to do was to show the shortest path from the start to the finish. Any output would work if it would show the original maze modified so that there is a path somehow visible.
I took an approach where I would read in the text from a file (as instructed) then would place each character into a 2-dimensional array (15x15). Next I would convert this into a linked list/tree with 4 pointers (up, down, left, right). Then I would use BFS to determine a path availible. Finally I would convert it back into an array so I could output the maze in a 15x15 format.
Heres an example of what the completed program would do:
.oxxxxooooooxxxx ......oooooxoxxo xoooo.oxxxxoooox xoxxx.xoo......x xxx...xoo.xxxx.x ooo.xxxxo.oxoo.x oxo.oxooo.oxoo.x oxo.oxooo.xooo.o oxo.oxxxx.xoxo.. oxo..xooo.xxxxx. xxxx.xxxx.xooxo. oooo.xo...oooxo. oxoo....xxxxxxo. oxxxxooooxx..... ooxoooooxox.xxxx oooooxxxoox.....
I could include my code but its very messy.
Any help would be greatly appreciated including any completely new ideas.