Question
import java.util.ArrayList; public class Maze { private char[][] cells; /** Constructs a maze from a string describing its contents. @param contents a string consisting of
import java.util.ArrayList; public class Maze { private char[][] cells; /** Constructs a maze from a string describing its contents. @param contents a string consisting of *, spaces, and newlines terminating the rows. */ public Maze(String contents) { int rows = 0; int columns = 0; int currentLength = 0; for (int i = 0; i
public ArrayList
for (int i = result.size() - 1; i >= 0; i--) { if (!isEmpty(result.get(i))) result.remove(i); } return result; }
/** Checks whether a location is an exit. @param loc the location @return true if the location is an exit */ public boolean isExit(Location loc) { /*-----IMPLEMENT THIS-----*/ return false; }
/** Checks whether a location is within the maze. @param loc the location @return true if the location is valid */ public boolean isValid(Location loc) { /*-----IMPLEMENT THIS-----*/ return false; }
/** Checks whether a location is within the maze and not a wall. @param loc the location @return true if the location is empty */ public boolean isEmpty(Location loc) { /*-----IMPLEMENT THIS-----*/ return false; } }
A location in a maze public class Location private int row; private int column; Constructs a location @param row the row @param column the column public Location(int row, int column) IMPLEMENT THIS Gets the row of this location @return the row public int getRow() IMPLEMENT THIS return 10; Gets the column of this location @return the column public int getColumn() IMPLEMENT THIS return 10; public String toString) row + ","+ column ")" public boolean equals (Object otherObject) Location other = (Location) otherObject; IMPLEMENT THIS* return false; A location in a maze public class Location private int row; private int column; Constructs a location @param row the row @param column the column public Location(int row, int column) IMPLEMENT THIS Gets the row of this location @return the row public int getRow() IMPLEMENT THIS return 10; Gets the column of this location @return the column public int getColumn() IMPLEMENT THIS return 10; public String toString) row + ","+ column ")" public boolean equals (Object otherObject) Location other = (Location) otherObject; IMPLEMENT THIS* return falseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started