|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMaze
public class Maze
Contains the maze struture, which is just an array of
MazeCell
s. Also contains the algorithms
for generating and solving the maze.
Constructor Summary | |
---|---|
Maze(int rows,
int cols)
Creates a maze that has the given number of rows and columns. |
Method Summary | |
---|---|
MazeCell |
getCell(int row,
int col)
Returns the cell in the maze at the given coordinates. |
int |
getCols()
Accessor that returns the number of columns in the maze. |
MazeCell |
getEndCell()
Accessor that returns the end cell for the maze. |
int |
getRows()
Accessor that returns the number of rows in the maze. |
MazeCell |
getStartCell()
Accessor that returns the start cell for the maze. |
void |
setEndCell(MazeCell cell)
Accessor that sets the end cell for the maze. |
void |
setStartCell(MazeCell cell)
Accessor that sets the start cell for the maze. |
void |
setViewer(MazeViewer viewer)
Accessor that sets the MazeViewer variable for
the maze. |
void |
solveBestBinaryMaze()
Solves the maze by best first search, with a binary heap. |
void |
solveBestThreeMaze()
Solves the maze by best first search, with a three heap. |
void |
solveBFSMaze()
Solves the maze by breadth first search. |
void |
solveDFSMaze()
Solves the maze by depth first search. |
void |
solveMaze(java.lang.String method)
Solve maze driver. |
void |
solveRandomMaze()
Solves the maze by randomly choosing a neighboring cell to explore. |
void |
visualize(MazeCell cell)
Tells the viewer to show the maze again, with any changes to cells updated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Maze(int rows, int cols)
rows
- Number of rows in the maze.cols
- Number of columns in the maze.Method Detail |
---|
public void setViewer(MazeViewer viewer)
MazeViewer
variable for
the maze. When the viewer is not set, no visualization takes place.
viewer
- Visual display place for the maze.public void setStartCell(MazeCell cell)
cell
- Start cell for the maze.public void setEndCell(MazeCell cell)
cell
- End cell for the maze.public MazeCell getStartCell()
public MazeCell getEndCell()
public int getRows()
public int getCols()
public MazeCell getCell(int row, int col)
row
- The row in the maze of the cell.col
- The column in the maze of the cell.
row
, col
)public void visualize(MazeCell cell)
cell
- Current cell, that the viewer will color.public void solveMaze(java.lang.String method)
method
- The method for solving the maze; one of
"dfs" = depth first search, "bfs" =
breadth first search, "best2" = best
first search with a binary heap,
"best3" = best first search with a 3-heap,
or "random" = random walk.public void solveRandomMaze()
public void solveDFSMaze()
public void solveBFSMaze()
public void solveBestBinaryMaze()
public void solveBestThreeMaze()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |