Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with Java public void escapeFromMaze(MazePoint[][] maze) Youre given a maze in the form of a 2d-array of MazePoint objects. You start at the

Need help with Java public void escapeFromMaze(MazePoint[][] maze)

Youre given a maze in the form of a 2d-array of MazePoint objects. You start at the top left corner of this maze. You want to find a path to go to the bottom right corner of the maze, which is the exit. You can only go right OR go down. All the Xs in this 2d-array mean blockers, and all -s means empty spaces you can move to. There will always be a path to the exit and there will never be any forks or dead ends.

Your job is to trace out the path taken to solve the maze. Modify the maze in place. Youre required to record the position of each step you take on your way using an asterisk (*) to replace -s. For example, if you have the following input 2d array, that 2d array will become the output array after this method is running:

image text in transcribed

public boolean testEscape(MazePoint[][] maze, MazePoint[][] expectedSolution)

This function takes in two parameters - a 2-d array of MazePoint objects representing the test input (maze), and another 2-d array of MazePoint objects that represents the expected maze after solving the escape puzzle (expectedSolution). The function should run escapeFromMaze on maze, and verify that it matches expectedSolution. The function returns a boolean value - true if the expected array matches the array returned by escapeFromMaze, and false otherwise. If the test fails it should also print the expected solution maze and the actual maze produced by testEscape, along with an error message.

This function must handle edge conditions gracefully. For example, what would happen if the input maze is null, or if the number of rows and/or columns is less than one? For each of these cases, your method should not crash, but instead display an appropriate error message and return.

Thanks

xxx xxx xxx: xxxx * * * * xxx X X X input output xxx xxx xxx: xxxx * * * * xxx X X X input output

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to the table in question

Answered: 1 week ago