|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Maze
Field Summary | |
static int |
CLEAR
|
static int |
M
Max number of rows in the Maze |
static int |
MINDIM
Minimum size of either dimension |
static int |
N
Max number of columns in the Maze |
static int |
VISIT
|
static int |
WALL
|
Constructor Summary | |
Maze()
Create Maze of the default size (M,N) with no walls (every (i,j) element is zero). |
|
Maze(int rows,
int columns,
int srow,
int scol,
int erow,
int ecol)
Create Maze of size (max(M,rows),max(N,columns)) with no walls (every (i,j) element is zero). |
Method Summary | |
java.util.LinkedList |
breadthFirstPathSearch()
Performs a Breadth-First Search for a path in through the maze form the entrance point to the exit point. |
void |
clearMaze()
Clears all walls from the maze |
void |
clearWall(int i,
int j)
Clears a wall from the (i,j)th position of the maze |
java.util.LinkedList |
depthFirstPathSearch()
Performs a Depth-First Search for a path in through the maze form the entrance point to the exit point. |
int |
getEndCol()
|
int |
getEndRow()
|
int |
getStartCol()
|
int |
getStartRow()
|
boolean |
isWall(int i,
int j)
|
int |
numColumns()
get the number of columns in the current maze |
int |
numRows()
get the number of rows in the current maze |
void |
putWall(int i,
int j)
Puts a wall in the (i,j)th position of the maze Will not put a wall at the entry or exit coordinates |
void |
setExitPosition(int new_i,
int new_j)
Set a new exit position in the maze |
void |
setStartPosition(int new_i,
int new_j)
Set a new start position in the maze |
java.lang.String |
toString()
Converts mxn maze to String of 0's and 1's for printing |
java.lang.String |
withPathToString(java.util.LinkedList path)
Converts mxn maze to String of 0's and 1's for printing |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int CLEAR
public static final int WALL
public static final int VISIT
public static final int M
public static final int N
public static final int MINDIM
Constructor Detail |
public Maze()
public Maze(int rows, int columns, int srow, int scol, int erow, int ecol)
rows
- number of rows in the maze, must be MINDIM or largercolumns
- number of columns in the maze, must be MINDIM or largersrow
- i position of maze start point (default is 0)scol
- j position of maze start point (default is 0)erow
- i position of maze end point (default is m-1)ecol
- j position of maze end point (default is n-1)Method Detail |
public void setStartPosition(int new_i, int new_j)
public void setExitPosition(int new_i, int new_j)
public int getStartRow()
public int getStartCol()
public int getEndRow()
public int getEndCol()
public int numRows()
public int numColumns()
public void putWall(int i, int j) throws java.lang.ArrayIndexOutOfBoundsException
i
- : row coordinatej
- : column coordinatepublic void clearWall(int i, int j) throws java.lang.ArrayIndexOutOfBoundsException
i
- : row coordinatej
- : column coordinatepublic void clearMaze()
public boolean isWall(int i, int j) throws java.lang.ArrayIndexOutOfBoundsException
i
- : row coordinatej
- : column coordinatepublic java.lang.String withPathToString(java.util.LinkedList path)
path:
- coordinates representing a path through the mazepublic java.lang.String toString()
public java.util.LinkedList breadthFirstPathSearch()
public java.util.LinkedList depthFirstPathSearch()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |