Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project nine input0.txt: input1.txt: input2.txt: input3.txt: Swamp.java: The Assignment Project #9 requires you to find an escape path from a given starting point in a

Project nine image text in transcribed
image text in transcribed
input0.txt:
image text in transcribed
input1.txt:
image text in transcribed
input2.txt:
image text in transcribed
input3.txt:
image text in transcribed
Swamp.java:
image text in transcribed
The Assignment Project #9 requires you to find an escape path from a given starting point in a maze. The maze (or swamp or mine field etc.) is a square 2D array of int. A value of zero in any cell represents a wall (land mine or quicksand ctc) while a value of one represents a possible step to take. Each input file will have a line at the top of the file that has the square dimension of the matris followed by the drop in point. The drop in point is the rowicol pair indicating where you are dropped into the swamp. You escape the swamp by taking one step at a time to any adjacent square that is a 1. You are not allowed to step on a zero cell. You must somchow remember which squares you have already stepped on in a path so that you don't get into an infinite loop. The five input files you are given have cycles and dead ends and valid paths to the edge of the swamp The starter file that you are given has one method already written for you that print the grid out in rectangular format. The second method load the grid from the input file. You must write this method using the printSWamp for clues 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 70% credit: innumti l simple path out. No dead ends. No cycles * 80% credit: in utLM l path out. Dead ends. No cycles . 9 % credit: mput2w multiple paths out. Dead ends. No cycles * 100% credit: input multiple paths out. Dead Ends. Cycles Here is what the output should look like for the above inputs if I run it separately on all four files: UsersItimDesktop)java Swamp inpute.txt [2,3J3,3J[4,4j[s,sj[6,6107,7][8,8]07,9] :UserstimDesktop>java Swamp input1.txt [2,3]3,3][4,2][5,1j6,e] c:Users\tim\Desktop>java Swamp input2.txt [4,4][3,5][2,4][1,41te,4] [4,4104,35,2][6,2[7,18,0] Users\timDesktop>java Swamp input3.txt [1,,2][2,3][1,410e,4] 1,,2[2,3]3,4][4,5][5,416,31[7,3] ,22,3]3,21[4,1]5,2][6,3117,3] :Users\timDesktop You are given this starter file: Swamp.java Do not modify main any more than needed Do not modify the given methods that load or print the grid. You are just to write and call the method(s) that print all escape paths

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

3. Go over a sample question first.

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago