Question
Model a maze in either Java or C++. Requirements: Maze must be a grid of at least 10 x 10 squares. From each square, an
Model a maze in either Java or C++.
Requirements: Maze must be a grid of at least 10 x 10 squares.
From each square, an agent (to come later) may or may not be able to move either up, down, left, or right depending on the walls in the maze.
There must be a start cell and a goal cell.
The must must be solvable.
The must must have at least one dead end.
The program must draw the maze (either as text or graphics).
One possible solution that we talked about in class is to store the maze as a 2D array. The coordinates in the array represent the positions of the squares. The values in the array represent the walls. We only need to store the presence of two walls (up and to the right, either present or not, for example) for a total of 4 possible values for each cell.
Separately store the location of the starting cell and goal cell.
Step 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