class Maze
extends java.lang.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<java.lang.String> |
enumerator(java.util.Set<java.lang.Integer> solutionSet)
Generates a list of lines representing the maze in text form.
|
Maze |
layout(java.util.Random random,
java.io.PrintWriter pw) |
void |
print(java.io.PrintWriter pw,
boolean space)
Prints the maze.
|
private int |
region(int cell) |
private void |
row(Maze.CellContent cellContent,
java.lang.StringBuilder b,
java.lang.StringBuilder b2,
int y)
Returns a pair of strings representing a row of the maze.
|
private void |
shuffle(java.util.Random random,
int[] ints)
Randomly permutes the members of an array.
|
(package private) java.util.Set<java.lang.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(java.io.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<java.lang.String> enumerator(java.util.Set<java.lang.Integer> solutionSet)
private void row(Maze.CellContent cellContent, java.lang.StringBuilder b, java.lang.StringBuilder b2, int y)
public Maze layout(java.util.Random random, java.io.PrintWriter pw)
java.util.Set<java.lang.Integer> solve(int x,
int y)
private void shuffle(java.util.Random random,
int[] ints)
random - Random number generatorints - Array of integers to shuffleCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.