Remove Some Walls to Form a Maze
Add required methods to remove the walls to form a maze.
We'll cover the following
Adding cell methods for removing walls
To generate a maze, MazeGenerator has to remove some walls. First, MazeGenerator will need a way to find which cells have not been added to the maze yet. In other words, it needs to identify which cells still have all four walls.
- In
Cell.java
, add a public method calledhasAllWalls()
. It should take no parameters and return a Boolean value. - Add a Boolean called
allWalls
which is true if every element in the wall istrue
using logical operators to compare the contents of each element. - Return
allWalls
.
...
________________ hasAllWalls(______) {
_______________ allWalls = ________ && ________ && ________ && ________;
return ________;
}
...
Get hands-on with 1200+ tech skills courses.