public class MimicFill extends Object
Modifier and Type | Field and Description |
---|---|
static boolean[][] |
boulders
Predefined sample; many small separate squares.
|
static boolean[][] |
cave
Predefined sample; a large, enclosed, organic space that usually makes large cave-like rooms,
|
static boolean[][] |
caves
Predefined sample; several medium-sized organic spaces that usually make tight, chaotic tunnels.
|
static boolean[][] |
chess
Predefined sample; a checkerboard pattern that typically loses recognition as such after generation.
|
static boolean[][] |
lessRooms
Predefined sample; produces rectangular rooms with small corridors between them.
|
static boolean[][] |
maze
Predefined sample; produces a suitable filler for a maze (but it is unlikely to connect both ends like a maze).
|
static boolean[][] |
openRooms |
static boolean[][] |
quarterBlack
Predefined sample; produces weird, large areas of "true" and "false" that suddenly change to the other.
|
static boolean[][] |
river
Predefined sample; produces multiple directions of flowing, river-like shapes made of "false".
|
static boolean[][] |
rooms
Predefined sample; produces rectangular rooms with a dense packing.
|
static boolean[][] |
ruins |
static boolean[][][] |
samples |
static boolean[][] |
simpleMaze
Predefined sample; produces an uncanny imitation of a maze with a tiny sample size.
|
static boolean[][] |
simpleRooms
Predefined sample; produces mostly rectangular rooms with very few corridor-like areas.
|
static boolean[][] |
thickWalls
Predefined sample; produces largely rectangular rooms with a good amount of thin corridors.
|
Modifier and Type | Method and Description |
---|---|
static boolean[][] |
andSamples(boolean[][] left,
boolean[][] right)
Runs a logical AND on each pair of booleans at the same position in left and right, and returns the result of all
the AND operations as a 2D boolean array (using the minimum dimensions shared between left and right).
|
static boolean[][] |
fill(boolean[][] sample,
int size,
double temperature,
int iterations,
RNG random) |
static boolean[][] |
mapToSample(char[][] map,
char... yes)
Converts a 2D char array map to a 2D boolean array, where any chars in the array or vararg yes will result in
true in the returned array at that position and any other chars will result in false.
|
static boolean[][] |
markSample(boolean[][] sample,
Iterable<Coord> points)
Given a 2D boolean array sample (usually a final product of this class' fill() method) and an Iterable of Coord
(such as a List or Set of Coord, but a Region can also work), copies sample, then marks every Coord in points as
true if it is in-bounds, and returns the modified copy of sample.
|
static boolean[][] |
orSamples(boolean[][] left,
boolean[][] right)
Runs a logical OR on each pair of booleans at the same position in left and right, and returns the result of all
the OR operations as a 2D boolean array (using the minimum dimensions shared between left and right).
|
static char[][] |
sampleToMap(boolean[][] sample,
char yes,
char no)
Comverts a 2D boolean array to a 2D char array, where false means the parameter no and true the parameter yes.
|
public static final boolean[][] boulders
public static final boolean[][] cave
public static final boolean[][] caves
public static final boolean[][] chess
public static final boolean[][] lessRooms
public static final boolean[][] maze
public static final boolean[][] quarterBlack
public static final boolean[][] river
public static final boolean[][] rooms
public static final boolean[][] simpleMaze
public static final boolean[][] simpleRooms
public static final boolean[][] thickWalls
public static final boolean[][] ruins
public static final boolean[][] openRooms
public static final boolean[][][] samples
public static boolean[][] mapToSample(char[][] map, char... yes)
map
- a 2D char array that you want converted to a 2D boolean arrayyes
- an array or vararg of the chars to consider true in mappublic static char[][] sampleToMap(boolean[][] sample, char yes, char no)
sample
- a 2D boolean array that you want converted to a 2D char arrayyes
- true in sample will be mapped to this char; usually '.'no
- false in sample will be mapped to this char; usually '#'public static boolean[][] orSamples(boolean[][] left, boolean[][] right)
left
- a 2D boolean arrayright
- another 2D boolean arraypublic static boolean[][] andSamples(boolean[][] left, boolean[][] right)
left
- a 2D boolean arrayright
- another 2D boolean arraypublic static boolean[][] markSample(boolean[][] sample, Iterable<Coord> points)
sample
- a 2D boolean array; will be copied, not modified directlypoints
- an Iterable (such as a List or Set) of Coord that will be marked as true if in-boundspublic static boolean[][] fill(boolean[][] sample, int size, double temperature, int iterations, RNG random)
sample
- a 2D boolean array to mimic visually; you can use mapToSample() if you have a 2D char arraysize
- the side length of the square boolean array to generatetemperature
- typically 0.2 works well for this, but other numbers between 0 and 1 may workiterations
- typically 3-5 works well for this; lower numbers may have slight problems with quality,
and higher numbers make this slightly slowerrandom
- an RNG to use for the random components of this techniqueCopyright © 2012–2016. All rights reserved.