class Maze extends Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static interface |
Maze.CellContent
Callback to get what to print in a particular cell.
|
private static class |
Maze.Direction
Direction.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) static boolean |
DEBUG |
(package private) int |
height |
private boolean |
horizontal |
private boolean[] |
lefts |
private int[] |
regions |
private boolean |
spiral |
private boolean[] |
ups |
private int |
width |
| Constructor and Description |
|---|
Maze(int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
Enumerator<String> |
enumerator(Set<Integer> solutionSet)
Generates a list of lines representing the maze in text form.
|
Maze |
layout(Random random,
PrintWriter pw) |
void |
print(PrintWriter pw,
boolean space)
Prints the maze.
|
private int |
region(int cell) |
private void |
row(Maze.CellContent cellContent,
StringBuilder b,
StringBuilder b2,
int y)
Returns a pair of strings representing a row of the maze.
|
private void |
shuffle(Random random,
int[] ints)
Randomly permutes the members of an array.
|
(package private) Set<Integer> |
solve(int x,
int y) |
private final int width
final int height
private final int[] regions
private final boolean[] ups
private final boolean[] lefts
static final boolean DEBUG
private final boolean horizontal
private final boolean spiral
private int region(int cell)
public void print(PrintWriter pw, boolean space)
+--+--+--+--+--+ | | | +--+ +--+--+ + | | | | + +--+ +--+ + | | +--+--+--+--+--+
pw - Print writerspace - Whether to put a space in each cell; if false, prints the
region number of the cellpublic Enumerator<String> enumerator(Set<Integer> solutionSet)
private void row(Maze.CellContent cellContent, StringBuilder b, StringBuilder b2, int y)
public Maze layout(Random random, PrintWriter pw)
private void shuffle(Random random, int[] ints)
random - Random number generatorints - Array of integers to shuffleCopyright © 2012–2017 The Apache Software Foundation. All rights reserved.