public class Maze
extends java.lang.Object
This class represents a randomly generated Maze, for use in CMSC132 projects at UMCP.
The Maze should be imagined as a rectangular grid of "Junctures" (intersections). There is a wall surrounding the entire grid. Adjacent junctures may or may not have a "wall" between them.
There is also a weight (positive integer) between any two junctures. This weight could be viewed as the "cost" of traveling from a juncture to an adjacent juncture.
| Constructor and Description |
|---|
Maze(int mazeHeight,
int mazeWidth,
int sparcity)
Construct random maze.
|
Maze(int mazeHeight,
int mazeWidth,
int sparcity,
long randomSeed)
This constructor also allows a seed for the random number generator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMazeHeight()
Returns the height of this maze.
|
int |
getMazeWidth()
Returns the width of this maze.
|
int |
getWeightAbove(Juncture juncture)
Returns the weight between this juncture and the one above.
|
int |
getWeightBelow(Juncture juncture)
Returns the weight between this juncture and the one below.
|
int |
getWeightToLeft(Juncture juncture)
Returns the weight between this juncture and the one to its
left.
|
int |
getWeightToRight(Juncture juncture)
Returns the weight between this juncture and the one to its
right.
|
boolean |
isWallAbove(Juncture juncture)
Returns true if there is a wall above the given juncture,
false otherwise.
|
boolean |
isWallBelow(Juncture juncture)
Returns true if there is a wall below the given juncture,
false otherwise.
|
boolean |
isWallToLeft(Juncture juncture)
Returns true if there is a wall to the left of the
given juncture, false otherwise.
|
boolean |
isWallToRight(Juncture juncture)
Returns true if there is a wall to the right of the
given juncture, false otherwise.
|
public Maze(int mazeHeight,
int mazeWidth,
int sparcity)
mazeHeight - mazeWidth - sparcity - value from 0 to 100. If set to 100, there is exactly one path
from any juncture to any other juncture. Lower values have fewer walls, hence
more paths between junctures.public Maze(int mazeHeight,
int mazeWidth,
int sparcity,
long randomSeed)
mazeHeight - mazeWidth - sparcity - randomSeed - public int getMazeWidth()
public int getMazeHeight()
public boolean isWallAbove(Juncture juncture)
juncture - public boolean isWallBelow(Juncture juncture)
juncture - public boolean isWallToLeft(Juncture juncture)
juncture - public boolean isWallToRight(Juncture juncture)
juncture - public int getWeightAbove(Juncture juncture)
juncture - public int getWeightBelow(Juncture juncture)
juncture - public int getWeightToLeft(Juncture juncture)
juncture - public int getWeightToRight(Juncture juncture)
juncture -