2023 SPRING CS 445
PROJECT #7: COMPLEX SWAMP
REMOVE -ALL- COMMENTS OF ANY KIND FROM YOUR CODE BEFORE HANDIN IN &anp MAKE SURE ANY METHODS YOU FILL OUT / ADD / MODIFY ARE ALL AT THE BOTTOM OF THE FILE
The Assignment
This problem is a more complex version of the Simple Swamp of Lab #7. Now you must find and print ALL paths from the origin
to the edge of the swamp. You will have multiple input files of incresing complexity.
printSwamp is NOT to be called in the code you hand in. It is just for debugging. Remove any calls to it from your handin version.
What You'll Need
Here are your input files. You cannot get credit for a higher (more difficult) input file unless your program correctly solves the lower (easier) files.
- 20% credit: swamp0.txt 1 simple path out no dead ends, no cycles
- 20% credit: swamp1.txt 1 path out. dead ends but no cycles
- 20% credit: swamp2.txt multiple paths out, dead ends, no cycles
- 20% credit: swamp3.txt multiple paths out, dead ends and cycles
- 20% credit: swamp4.txt multiple paths out, lots of dead ends and cycles
Here is what the output should look like for the above inputs if I run it separately on all four files:





You are given this starter file: Swamp.java
- Do not modify main any more than needed.
- The only output you are to write is one line per escape path and it must be in the exact format as my sample output.
If there are no escape paths then your code prints out no additional output.
- Your escape path lines may be in a different order than mine but the row,col values must match exactly in matching lines.
- Your program must find and print ALL the escape paths. Lines may be in any order though.
- Do not print any other output of any kind other than what my solution does.
- DO NOT PRINT "DEAD END" OR *ANY* OUTPUT IF THERE ARE NO PATHS OUT. JUST PRINT NOTHING!
You may solve it any way you want - BUT - Here is a very good approach; a Depth First Search greedy algorithm