Explorar el Código

Delete stuff I don't use

smelc hace 7 años
padre
commit
856a98d19a

+ 0 - 434
squidlib-util/src/main/java/squidpony/squidgrid/DetailedMimic.java

@@ -1,434 +0,0 @@
-/*
-The MIT License(MIT)
-Copyright(c) mxgmn 2016.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
-*/
-package squidpony.squidgrid;
-
-import squidpony.GwtCompatibility;
-import squidpony.squidgrid.mapping.AestheticDifference;
-import squidpony.squidmath.IntDoubleOrderedMap;
-import squidpony.squidmath.IntVLA;
-import squidpony.squidmath.OrderedSet;
-import squidpony.squidmath.RNG;
-
-/**
- * Similar to MimicFill, this class can be used to imitate the style of an existing piece of data, but this works on
- * more than just booleans; it can produce similar styles of texture (its original use in SynTex), of map, of item
- * placement, and so on by specifying a different technique for differentiating two int values.
- * <br>
- * Two options are now available; the process() method allows the slow analyze() step to be computed once,
- * before the rest of processing is potentially done many times, but the new neoProcess() method produces
- * comparable or better results and is drastically faster even without needing analysis. This means
- * neoProcess(), based on P.F. Harrison's algorithm in SynTex, is strongly recommended now.
- * <br>
- * Example results of neoProcess(), with a procedural dungeon first and the mimic versions after it:
- * https://gist.github.com/tommyettinger/405336fb0fc74838d806c021aabe77da (you may need to click Raw and zoom
- * out somewhat for it to render well).
- * <br>
- * Ported from https://github.com/mxgmn/SynTex by Tommy Ettinger on 6/9/2016.
- */
-public class DetailedMimic {
-
-    private DetailedMimic()
-    {
-    }
-
-    public DetailedMimic(AestheticDifference diff)
-    {
-        this(diff, new RNG());
-    }
-    public DetailedMimic(AestheticDifference diff, RNG rng)
-    {
-        random = rng;
-        difference = diff;
-        analyzed = null;
-    }
-
-    public void analyze(int[] sample, int width, int height, int detailLevel, int proximity, boolean discrete)
-    {
-        if(detailLevel > 0)
-            analysis(sample, width, height, detailLevel, proximity, discrete);
-    }
-
-    public int[] process(int[] sample, int sampleWidth, int sampleHeight, int targetWidth, int targetHeight,
-                         int detailLevel, int proximity, double temperature, boolean discrete)
-    {
-        if(detailLevel > 0)
-        {
-            if(analyzed == null || analyzed.length != sampleWidth || analyzed.length == 0 ||
-                    analyzed[0].length != sampleHeight)
-                analyze(sample, sampleWidth, sampleHeight, detailLevel, proximity, discrete);
-            return coherentSynthesis(sample, sampleWidth, sampleHeight, analyzed, proximity,
-                    targetWidth, targetHeight, temperature, discrete);
-        }
-        else {
-            return fullSynthesis(sample, sampleWidth, sampleHeight, proximity,
-                    targetWidth, targetHeight, temperature, discrete);
-        }
-    }
-
-    public int[] neoProcess(int[] sample, int sampleWidth, int sampleHeight, int targetWidth, int targetHeight,
-                         int detailLevel, int proximity, boolean discrete)
-    {
-            return reSynthesis(sample, sampleWidth, sampleHeight, proximity, 20,
-                    Math.max(1, detailLevel), discrete, targetWidth, targetHeight);
-    }
-
-    public RNG random;
-    public AestheticDifference difference;
-    private int[][] analyzed;
-
-    private void analysis(int[] bitmap, int width, int height, int K, int N, boolean indexed)
-    {
-        int area = width * height;
-        analyzed = new int[area][];
-        OrderedSet<Integer> points = new OrderedSet<>(area);
-        for (int i = 0; i < area; i++) points.add(i);
-
-        double[] similarities = new double[area * area];
-        for (int i = 0; i < area; i++) for (int j = 0; j < area; j++)
-            similarities[i * area + j] = similarities[j * area + i] != 0 ? similarities[j * area + i] :
-                    similarity(i, bitmap, width, height, j, bitmap, width, height, N, null, indexed);
-
-        for (int i = 0; i < area; i++)
-        {
-            analyzed[i] = new int[K];
-            OrderedSet<Integer> copy = new OrderedSet<>(points);
-
-            analyzed[i][0] = i;
-            copy.remove(i);
-
-            for (int k = 1; k < K; k++)
-            {
-                double max = -10000;
-                int argmax = -1;
-
-                for(Integer p : copy)
-                {
-                    double s = similarities[i * area + p];
-                    if (s > max)
-                    {
-                        max = s;
-                        argmax = p;
-                    }
-                }
-
-                analyzed[i][k] = argmax;
-                copy.remove(argmax);
-            }
-        }
-    }
-
-    private int[] coherentSynthesis(int[] sample, int SW, int SH, int[][] sets, int N, int OW, int OH, double t, boolean indexed)
-    {
-        int[] result = new int[OW * OH];
-        Integer[] origins = new Integer[OW * OH];
-        boolean[][] mask = new boolean[SW][SH], cleanMask = new boolean[SW][SH];
-
-        for (int i = 0; i < OW * OH; i++)
-        {
-            int x = i % OW, y = i / OW;
-            IntDoubleOrderedMap candidates = new IntDoubleOrderedMap();
-            GwtCompatibility.insert2D(cleanMask, mask, 0, 0);
-
-            for (int dy = -1; dy <= 1; dy++){
-                for (int dx = -1; dx <= 1; dx++)
-                {
-                    int sx = (x + dx + OW) % OW, sy = (y + dy + OH) % OH;
-                    Integer origin = origins[sy * OW + sx];
-                    if ((dx != 0 || dy != 0) && origin != null)
-                    {
-                        for (int pi = 0, p; pi < sets[origin].length; pi++)
-                        {
-                            p = sets[origin][pi];
-                            int ox = (p % SW - dx + SW) % SW, oy = (p / SW - dy + SH) % SH;
-                            double s = similarity(oy * SW + ox, sample, SW, SH, i, result, OW, OH, N, origins, indexed);
-
-                            if (!mask[ox][oy]) candidates.put(ox + oy * SW, Math.pow(100, s / t));
-                            mask[ox][oy] = true;
-                        }
-                    }
-                }
-            }
-
-            int shifted = candidates.isEmpty() ? random.nextInt(SW) + random.nextInt(SH) * SW : weightedRandom(candidates, random.nextDouble());
-            origins[i] = shifted;
-            result[i] = sample[shifted];
-        }
-
-        return result;
-    }
-
-    private int[] fullSynthesis(int[] sample, int SW, int SH, int N, int OW, int OH, double t, boolean indexed)
-    {
-        int[] result = new int[OW * OH];
-        Integer[] origins = new Integer[OW * OH];
-
-        if (!indexed) for (int y = 0; y < OH; y++) {
-            for (int x = 0; x < OW; x++){
-                if (y + N >= OH)
-                {
-                    result[x + y * OW] = sample[random.nextInt(SW * SH)];
-                    origins[x + y * OW] = -1;
-                }
-            }
-        }
-
-        for (int i = 0; i < OW * OH; i++)
-        {
-            double[] candidates = new double[SW * SH];
-            double max = -10000;
-            int argmax = -1;
-
-            for (int j = 0; j < SW * SH; j++)
-            {
-                double s = similarity(j, sample, SW, SH, i, result, OW, OH, N, origins, indexed);
-                if (s > max)
-                {
-                    max = s;
-                    argmax = j;
-                }
-
-                if (indexed) candidates[j] = Math.pow(100.0, s / t);
-            }
-
-            if (indexed) argmax = weightedRandom(candidates, random.nextDouble());
-            result[i] = sample[argmax];
-            origins[i] = -1;
-        }
-
-        return result;
-    }
-
-
-    private int[] reSynthesis(int[] sample, int SW, int SH, int N, int M, int polish, boolean indexed, int OW, int OH)
-    {
-        IntVLA colors = new IntVLA();
-        int[] indexedSample = new int[Math.min(SW * SH, sample.length)];
-        for (int j = 0; j < indexedSample.length; j++)
-        {
-            int color = sample[j];
-
-            int i = 0;
-            for (int cn = 0; cn < colors.size; cn++)
-            {
-                if(colors.get(cn) == color) break;
-                i++;
-            }
-
-            if (i == colors.size) colors.add(color);
-            indexedSample[j] = i;
-        }
-
-        int colorsNumber = colors.size;
-
-        double[][] colorMetric = null;
-        if (!indexed && colorsNumber <= 1024)
-        {
-            colorMetric = new double[colorsNumber][colorsNumber];
-            for (int x = 0; x < colorsNumber; x++)
-            {
-                for (int y = 0; y < colorsNumber; y++)
-                {
-                    int cx = colors.get(x), cy = colors.get(y);
-                    colorMetric[x][y] = difference.difference(cx, cy);
-                }
-            }
-        }
-
-        int[] origins = new int[OW * OH];
-        for (int i = 0; i < origins.length; i++) origins[i] = -1;
-
-        int[] shuffle = new int[OW * OH];
-        for (int i = 0; i < shuffle.length; i++)
-        {
-            int j = random.nextIntHasty(i + 1);
-            if (j != i) shuffle[i] = shuffle[j];
-            shuffle[j] = i;
-        }
-
-        for (int round = 0; round <= polish; round++) for (int counter = 0; counter < shuffle.length; counter++)
-        {
-            int f = shuffle[counter];
-            int fx = f % OW, fy = f / OW;
-            int neighborsNumber = round > 0 ? 8 : Math.min(8, counter);
-            int neighborsFound = 0;
-
-            int[] candidates = new int[neighborsNumber + M];
-
-            if (neighborsNumber > 0)
-            {
-                int[] neighbors = new int[neighborsNumber];
-                int[] x = new int[4], y = new int[4];
-
-                for (int radius = 1; neighborsFound < neighborsNumber; radius++)
-                {
-                    x[0] = fx - radius;
-                    y[0] = fy - radius;
-                    x[1] = fx - radius;
-                    y[1] = fy + radius;
-                    x[2] = fx + radius;
-                    y[2] = fy + radius;
-                    x[3] = fx + radius;
-                    y[3] = fy - radius;
-
-                    for (int k = 0; k < 2 * radius; k++)
-                    {
-                        for (int d = 0; d < 4; d++)
-                        {
-                            x[d] = (x[d] + 10 * OW) % OW;
-                            y[d] = (y[d] + 10 * OH) % OH;
-
-                            if (neighborsFound >= neighborsNumber) continue;
-                            int point = x[d] + y[d] * OW;
-                            if (origins[point] != -1)
-                            {
-                                neighbors[neighborsFound] = point;
-                                neighborsFound++;
-                            }
-                        }
-
-                        y[0]++;
-                        x[1]++;
-                        y[2]--;
-                        x[3]--;
-                    }
-                }
-
-
-                for (int n = 0; n < neighborsNumber; n++)
-                {
-                    int cx = (origins[neighbors[n]] + (f - neighbors[n]) % OW + 100 * SW) % SW;
-                    int cy = (origins[neighbors[n]] / SW + f / OW - neighbors[n] / OW + 100 * SH) % SH;
-                    candidates[n] = cx + cy * SW;
-                }
-            }
-
-            for (int m = 0; m < M; m++) candidates[neighborsNumber + m] = random.nextIntHasty(SW * SH);
-
-            double max = -1E+10;
-            int argmax = -1;
-
-            for (int c = 0; c < candidates.length; c++)
-            {
-                double sum = random.nextDouble(0.000001);
-                int ix = candidates[c] % SW, iy = candidates[c] / SW, jx = f % OW, jy = f / OW;
-                int SX, SY, FX, FY, S, F;
-                int origin;
-
-                for (int dy = -N; dy <= N; dy++)
-                {
-                    for (int dx = -N; dx <= N; dx++)
-                    {
-                        if (dx != 0 || dy != 0)
-                        {
-                            SX = ix + dx;
-                            if (SX < 0) SX += SW;
-                            else if (SX >= SW) SX -= SW;
-
-                            SY = iy + dy;
-                            if (SY < 0) SY += SH;
-                            else if (SY >= SH) SY -= SH;
-
-                            FX = jx + dx;
-                            if (FX < 0) FX += OW;
-                            else if (FX >= OW) FX -= OW;
-
-                            FY = jy + dy;
-                            if (FY < 0) FY += OH;
-                            else if (FY >= OH) FY -= OH;
-
-                            S = SX + SY * SW;
-                            F = FX + FY * OW;
-
-                            origin = origins[F];
-                            if (origin != -1)
-                            {
-                                if (indexed) sum += sample[origin] == sample[S] ? 1 : -1;
-                                else if (colorMetric != null) sum += colorMetric[indexedSample[origin]][indexedSample[S]];
-                                else sum += difference.difference(sample[origin], sample[S]);
-                            }
-                        }
-                    }
-                }
-
-                if (sum >= max)
-                {
-                    max = sum;
-                    argmax = candidates[c];
-                }
-            }
-
-            origins[f] = argmax;
-        }
-
-        int[] result = new int[OW * OH];
-        for (int i = 0; i < result.length; i++) result[i] = sample[origins[i]];
-        return result;
-    }
-
-    private double similarity(int i1, int[] b1, int w1, int h1, int i2, int[] b2, int w2, int h2, int N, Integer[] origins, boolean indexed)
-    {
-        double sum = 0;
-        int x1 = i1 % w1, y1 = i1 / w1, x2 = i2 % w2, y2 = i2 / w2;
-
-        for (int dy = -N; dy <= 0; dy++) for (int dx = -N; (dy < 0 && dx <= N) || (dy == 0 && dx < 0); dx++)
-        {
-            int sx1 = (x1 + dx + w1) % w1, sy1 = (y1 + dy + h1) % h1;
-            int sx2 = (x2 + dx + w2) % w2, sy2 = (y2 + dy + h2) % h2;
-
-            int c1 = b1[sx1 + sy1 * w1];
-            int c2 = b2[sx2 + sy2 * w2];
-
-            if (origins == null || origins[sy2 * w2 + sx2] != null)
-            {
-                if (indexed)
-                    sum += c1 == c2 ? 1 : -1;
-                else
-                    sum -= difference.difference(c1, c2);
-                    /*
-                    Color C1 = Color.FromArgb(c1), C2 = Color.FromArgb(c2);
-                    sum -= (double)((C1.R - C2.R) * (C1.R - C2.R) + (C1.G - C2.G) * (C1.G - C2.G) + (C1.B - C2.B) * (C1.B - C2.B)) / 65536.0;
-                    */
-            }
-        }
-
-        return sum;
-    }
-
-    private static int weightedRandom(double[] array, double r)
-    {
-        double sum = 0;
-        for (int j = 0; j < array.length; j++)
-            sum += Math.max(1.0, array[j]);
-
-        for (int j = 0; j < array.length; j++)
-            array[j] /= sum;
-
-        int i = 0;
-        double x = 0;
-
-        while (i < array.length)
-        {
-            x += array[i];
-            if (r <= x) return i;
-            i++;
-        }
-
-        return 0;
-    }
-
-    private static int weightedRandom(IntDoubleOrderedMap dic, double r) {
-        int[] ints = new int[dic.size()];
-        double[] doubles = new double[dic.size()];
-        dic.keySet().toArray(ints);
-        dic.values().toArray(doubles);
-        return ints[weightedRandom(doubles, r)];
-    }
-}

+ 0 - 589
squidlib-util/src/main/java/squidpony/squidgrid/MimicFill.java

@@ -1,589 +0,0 @@
-package squidpony.squidgrid;
-
-import squidpony.GwtCompatibility;
-import squidpony.squidmath.Coord;
-import squidpony.squidmath.RNG;
-
-/**
- * A class that imitates patterns in an existing 2D boolean array and uses it to generate a new boolean array with a
- * similar visual style. Useful for creating procedural filler around a desired path or series of known rooms. Can also
- * convert between 2D boolean arrays (samples) and 2D char arrays (maps).
- * Created by Tommy Ettinger on 5/14/2016, porting from https://github.com/mxgmn/ConvChain (public domain)
- */
-public class MimicFill {
-
-    private static final int N = 3;
-
-    private MimicFill()
-    {
-
-    }
-    /**
-     * 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. The result can be given to
-     * fill() as its sample parameter.
-     * @param map a 2D char array that you want converted to a 2D boolean array
-     * @param yes an array or vararg of the chars to consider true in map
-     * @return a 2D boolean array that can be given to fill()
-     */
-    public static boolean[][] mapToSample(char[][] map, char... yes)
-    {
-        if(map == null || map.length == 0)
-            return new boolean[0][0];
-        boolean[][] sample = new boolean[map.length][map[0].length];
-        if(yes == null || yes.length == 0)
-            return sample;
-        for (int x = 0; x < map.length; x++) {
-            for (int y = 0; y < map[0].length; y++) {
-                for (int c = 0; c < yes.length; c++) {
-                    if(sample[x][y] = map[x][y] == yes[c])
-                        break;
-                }
-            }
-        }
-        return sample;
-    }
-
-    /**
-     * Comverts a 2D boolean array to a 2D char array, where false means the parameter no and true the parameter yes.
-     * @param sample a 2D boolean array that you want converted to a 2D char array
-     * @param yes true in sample will be mapped to this char; usually '.'
-     * @param no false in sample will be mapped to this char; usually '#'
-     * @return a 2D char array containing only the chars yes and no
-     */
-    public static char[][] sampleToMap(boolean[][] sample, char yes, char no)
-    {
-
-        if(sample == null || sample.length == 0)
-            return new char[0][0];
-        char[][] map = new char[sample.length][sample[0].length];
-        for (int x = 0; x < sample.length; x++) {
-            for (int y = 0; y < sample[0].length; y++) {
-                map[x][y] = (sample[x][y]) ? yes : no;
-            }
-        }
-        return map;
-    }
-
-    /**
-     * 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).
-     * @param left a 2D boolean array
-     * @param right another 2D boolean array
-     * @return the 2D array resulting from a logical OR on each pair of booleans at a point shared by left and right
-     */
-    public static boolean[][] orSamples(boolean[][] left, boolean[][] right)
-    {
-        if(left == null && right == null) return new boolean[0][0];
-        else if(left == null || left.length <= 0) return GwtCompatibility.copy2D(right);
-        else if(right == null || right.length <= 0) return GwtCompatibility.copy2D(left);
-
-        int width = Math.min(left.length, right.length),
-                height = Math.min(left[0].length, right[0].length);
-        boolean[][] done = new boolean[width][height];
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                done[x][y] = left[x][y] || right[x][y];
-            }
-        }
-        return done;
-    }
-
-
-    /**
-     * 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).
-     * @param left a 2D boolean array
-     * @param right another 2D boolean array
-     * @return the 2D array resulting from a logical AND on each pair of booleans at a point shared by left and right
-     */
-    public static boolean[][] andSamples(boolean[][] left, boolean[][] right)
-    {
-        if(left == null || right == null || left.length <= 0 || right.length <= 0) return new boolean[0][0];
-
-        int width = Math.min(left.length, right.length),
-                height = Math.min(left[0].length, right[0].length);
-        boolean[][] done = new boolean[width][height];
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                done[x][y] = left[x][y] && right[x][y];
-            }
-        }
-        return done;
-    }
-
-    /**
-     * 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. Does not alter the original sample. You may
-     * want to use this with techniques like drawing a long line with Bresenham, OrthoLine, or WobblyLine, potentially
-     * widening the line with Radius.expand(), and then passing the result as the Iterable of Coord. You could then make
-     * the start and end of the line into an entrance and exit and be sure the player can get from one to the other
-     * (except for Bresenham and other lines that may make diagonal movements, if the player cannot move diagonally).
-     * @param sample a 2D boolean array; will be copied, not modified directly
-     * @param points an Iterable (such as a List or Set) of Coord that will be marked as true if in-bounds
-     * @return a copy of sample with the Coords in points marked as true
-     */
-    public static boolean[][] markSample(boolean[][] sample, Iterable<Coord> points)
-    {
-        if(sample == null || sample.length <= 0)
-            return new boolean[0][0];
-        boolean[][] sample2 = GwtCompatibility.copy2D(sample);
-        int width = sample2.length, height = sample2[0].length;
-        for(Coord c : points)
-        {
-            if(c.x >= 0 && c.x < width && c.y >= 0 && c.y < height)
-            {
-                sample2[c.x][c.y] = true;
-            }
-        }
-        return sample2;
-    }
-
-    /**
-     *
-     * @param sample a 2D boolean array to mimic visually; you can use mapToSample() if you have a 2D char array
-     * @param size the side length of the square boolean array to generate
-     * @param temperature typically 0.2 works well for this, but other numbers between 0 and 1 may work
-     * @param iterations typically 3-5 works well for this; lower numbers may have slight problems with quality,
-     *                   and higher numbers make this slightly slower
-     * @param random an RNG to use for the random components of this technique
-     * @return a new 2D boolean array, width = size, height = size, mimicking the visual style of sample
-     */
-    public static boolean[][] fill(boolean[][] sample, int size, double temperature, int iterations, RNG random) {
-        boolean[][] field = new boolean[size][size];
-        double[] weights = new double[1 << (N * N)];
-
-        for (int x = 0; x < sample.length; x++) {
-            for (int y = 0; y < sample[x].length; y++) {
-                Pattern[] p = new Pattern[8];
-
-                p[0] = new Pattern(sample, x, y, N);
-                p[1] = p[0].rotate();
-                p[2] = p[1].rotate();
-                p[3] = p[2].rotate();
-                p[4] = p[0].reflect();
-                p[5] = p[1].reflect();
-                p[6] = p[2].reflect();
-                p[7] = p[3].reflect();
-
-                for (int k = 0; k < 8; k++) {
-                    weights[p[k].index()]++;
-                }
-            }
-        }
-
-        for (int k = 0; k < weights.length; k++) {
-            if (weights[k] <= 0)
-                weights[k] = 0.1;
-        }
-        for (int y = 0; y < size; y++) {
-            for (int x = 0; x < size; x++) {
-                field[x][y] = random.nextBoolean();
-            }
-        }
-
-        int i, j;
-        double p, q;
-        for (int k = 0; k < iterations * size * size; k++) {
-            i = random.nextInt(size);
-            j = random.nextInt(size);
-
-            p = 1.0;
-            for (int y = j - N + 1; y <= j + N - 1; y++)
-                for (int x = i - N + 1; x <= i + N - 1; x++) p *= weights[Pattern.index(field, x, y, N)];
-
-            field[i][j] = !field[i][j];
-
-            q = 1.0;
-            for (int y = j - N + 1; y <= j + N - 1; y++)
-                for (int x = i - N + 1; x <= i + N - 1; x++) q *= weights[Pattern.index(field, x, y, N)];
-
-
-            if (Math.pow(q / p, 1.0 / temperature) < random.nextDouble())
-                field[i][j] = !field[i][j];
-        }
-        return field;
-    }
-
-    private static class Pattern {
-        public boolean[][] data;
-
-
-        Pattern(boolean[][] exact) {
-            data = exact;
-        }
-
-        Pattern(boolean[][] field, int x, int y, int size) {
-            data = new boolean[size][size];
-            for (int i = 0; i < size; i++) {
-                for (int j = 0; j < size; j++) {
-                    data[i][j] =
-                            field[(x + i + field.length) % field.length][(y + j + field[0].length) % field[0].length];
-                }
-            }
-        }
-
-        Pattern rotate() {
-            boolean[][] next = new boolean[data.length][data.length];
-            for (int x = 0; x < data.length; x++) {
-                for (int y = 0; y < data.length; y++) {
-                    next[data.length - 1 - y][x] = data[x][y];
-                }
-            }
-            return new Pattern(next);
-        }
-
-        Pattern reflect() {
-            boolean[][] next = new boolean[data.length][data.length];
-            for (int x = 0; x < data.length; x++) {
-                for (int y = 0; y < data.length; y++) {
-                    next[data.length - 1 - x][y] = data[x][y];
-                }
-            }
-            return new Pattern(next);
-        }
-
-        int index() {
-            int result = 0;
-            for (int y = 0; y < data.length; y++) {
-                for (int x = 0; x < data.length; x++) {
-                    result += data[x][y] ? 1 << (y * data.length + x) : 0;
-                }
-            }
-            return result;
-        }
-
-        static int index(boolean[][] field, int x, int y, int size) {
-            int result = 0;
-            for (int i = 0; i < size; i++) {
-                for (int j = 0; j < size; j++) {
-                    if (field[(x + i + field.length) % field.length][(y + j + field[0].length) % field[0].length])
-                        result += 1 << (j * size + i);
-                }
-            }
-            return result;
-        }
-    }
-
-    /**
-     * Predefined sample; many small separate squares.
-     */
-    public static final boolean[][] boulders = new boolean[][]{
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true,false,false,true,true,true},
-            new boolean[]{true,true,false,false,true,true,false,false,true,true,true,false,false,true,true,true},
-            new boolean[]{true,true,false,false,true,true,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,false,false,true,true,false,false,true},
-            new boolean[]{true,true,true,false,false,true,false,false,true,false,false,true,true,false,false,true},
-            new boolean[]{true,true,true,false,false,true,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,true,true,false,false,true,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,false,false,true,false,false,true,true,true,false,false,true,true},
-            new boolean[]{true,false,false,true,true,true,true,true,true,true,true,true,false,false,true,true},
-            new boolean[]{true,false,false,true,false,false,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,false,false,true,true,true,false,false,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,false,false,true,false,false,true,true},
-            new boolean[]{true,false,false,true,true,true,false,false,true,true,true,true,false,false,true,true},
-            new boolean[]{true,false,false,true,true,true,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true}
-    };
-
-    /**
-     * Predefined sample; a large, enclosed, organic space that usually makes large cave-like rooms,
-     */
-    public static final boolean[][] cave = new boolean[][]{
-            new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
-            new boolean[]{false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false},
-            new boolean[]{false, false, false, true, true, true, false, false, true, true, true, true, true, true, false, false},
-            new boolean[]{false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false},
-            new boolean[]{false, false, true, true, true, true, true, true, true, true, true, true, true, true, false, false},
-            new boolean[]{false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, false},
-            new boolean[]{false, false, false, true, true, true, true, true, true, true, true, true, true, false, false, false},
-            new boolean[]{false, false, false, false, true, true, true, true, true, true, true, true, false, false, false, false},
-            new boolean[]{false, false, false, false, true, true, true, true, true, true, true, true, true, false, false, false},
-            new boolean[]{false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false},
-            new boolean[]{false, false, true, true, true, true, true, true, true, true, true, true, true, true, false, false},
-            new boolean[]{false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false},
-            new boolean[]{false, false, false, true, true, true, true, true, false, false, true, true, true, true, true, false},
-            new boolean[]{false, false, false, false, true, true, true, false, false, false, false, true, true, false, false, false},
-            new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
-            new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}
-    };
-
-    /**
-     * Predefined sample; several medium-sized organic spaces that usually make tight, chaotic tunnels.
-     */
-    public static final boolean[][] caves = new boolean[][]{
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,true,true,false,false,false},
-            new boolean[]{false,false,true,true,true,false,false,false,false,false,false,true,true,false,false,false},
-            new boolean[]{false,true,true,true,true,true,false,false,false,false,true,true,true,true,false,false},
-            new boolean[]{false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,true,true,true,true,true,true,true},
-            new boolean[]{false,false,true,true,true,true,true,false,false,false,true,true,true,true,false,false},
-            new boolean[]{false,false,false,true,true,true,false,false,false,false,false,true,true,false,false,false},
-            new boolean[]{false,false,false,false,true,true,false,false,false,false,false,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,false,false,false,false,false,true,true,true,false,false,false},
-            new boolean[]{false,false,true,true,true,true,false,false,false,true,true,true,true,true,false,false},
-            new boolean[]{false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,false,false,true,true,true,true,true,true,true},
-            new boolean[]{false,true,true,true,true,true,false,false,false,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,false,false,false,false,true,true,true,true,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false}
-    };
-
-    /**
-     * Predefined sample; a checkerboard pattern that typically loses recognition as such after generation.
-     */
-    public static final boolean[][] chess = new boolean[][]{
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true},
-            new boolean[]{true,false,true,false,true,false,true,false,true,false,true,false,true,false,true,false},
-            new boolean[]{false,true,false,true,false,true,false,true,false,true,false,true,false,true,false,true}
-    };
-
-    /**
-     * Predefined sample; produces rectangular rooms with small corridors between them.
-     */
-    public static final boolean[][] lessRooms = new boolean[][]{
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,false,false,false,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{false,false,true,false,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,false,false,true,false,false,false,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,false,false,true,false,false,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,false,true,false,false,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true},
-            new boolean[]{false,false,true,true,true,true,true,true,true,true,true,true,true,false,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false}
-    };
-
-    /**
-     * Predefined sample; produces a suitable filler for a maze (but it is unlikely to connect both ends like a maze).
-     */
-    public static final boolean[][] maze = new boolean[][]{
-            new boolean[]{true,true,true,true,true,false,false,false,false,true,true,true,false,true,true,false},
-            new boolean[]{true,false,false,false,true,false,true,true,false,true,false,false,false,false,false,false},
-            new boolean[]{true,false,true,true,true,false,true,false,false,false,false,true,true,true,false,true},
-            new boolean[]{true,false,false,false,false,false,true,false,true,true,true,true,false,true,false,false},
-            new boolean[]{true,true,true,false,true,true,true,false,false,false,false,true,false,false,false,true},
-            new boolean[]{false,false,false,false,false,false,true,true,true,true,false,true,false,true,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,false,true,false,true,false,true,false,true},
-            new boolean[]{false,false,false,false,false,false,true,true,false,true,true,true,false,true,false,true},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,false,false,true,false,false},
-            new boolean[]{false,false,false,true,false,false,false,true,true,false,true,true,true,true,false,true},
-            new boolean[]{true,true,false,true,false,true,true,true,false,false,false,false,false,false,false,false},
-            new boolean[]{true,false,false,true,false,true,false,true,false,true,true,false,true,false,true,true},
-            new boolean[]{true,true,true,true,false,false,false,true,false,false,true,false,true,false,false,true},
-            new boolean[]{false,false,true,true,false,true,true,true,true,true,true,false,true,true,false,false},
-            new boolean[]{true,false,false,false,false,false,false,false,false,true,true,false,false,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,true,true,true,false,true,true,false}
-    };
-
-    /**
-     * Predefined sample; produces weird, large areas of "true" and "false" that suddenly change to the other.
-     */
-    public static final boolean[][] quarterBlack = new boolean[][]{
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true}
-    };
-
-    /**
-     * Predefined sample; produces multiple directions of flowing, river-like shapes made of "false".
-     */
-    public static final boolean[][] river = new boolean[][]{
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,false,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,false,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true}
-    };
-
-    /**
-     * Predefined sample; produces rectangular rooms with a dense packing.
-     */
-    public static final boolean[][] rooms = new boolean[][]{
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true},
-            new boolean[]{false,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,true,true,true,true,true,true,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,false,false,true,false,false,false,false},
-            new boolean[]{false,false,true,false,false,false,false,false,false,false,false,true,false,false,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,true,true,true,true,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,true,true,true,true,true,true},
-            new boolean[]{false,false,true,true,true,true,true,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,false,false,false,false,true,false,false,false},
-            new boolean[]{false,false,false,true,false,false,false,false,false,false,false,false,true,false,false,false}
-    };
-
-    /**
-     * Predefined sample; produces an uncanny imitation of a maze with a tiny sample size.
-     */
-    public static final boolean[][] simpleMaze = new boolean[][]{
-            new boolean[]{true,true,true,true},
-            new boolean[]{true,false,false,false},
-            new boolean[]{true,false,true,false},
-            new boolean[]{true,false,false,false}
-    };
-
-    /**
-     * Predefined sample; produces mostly rectangular rooms with very few corridor-like areas.
-     */
-    public static final boolean[][] simpleRooms = new boolean[][]{
-            new boolean[]{false,false,false,false,false,true,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,true,false,false,false,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{false,false,false,false,false,true,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,true,false,false,false,false,false}
-    };
-
-    /**
-     * Predefined sample; produces largely rectangular rooms with a good amount of thin corridors.
-     */
-    public static final boolean[][] thickWalls = new boolean[][]{
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,false,false,false,false,false,false,false}
-    };
-
-    public static final boolean[][] ruins = new boolean[][]{
-            new boolean[]{false,true,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true},
-            new boolean[]{false,true,false,false,false,false,false,true,true,false,false,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true},
-            new boolean[]{false,true,false,false,false,false,false,false,true,false,false,false,false,false,false,true,true,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,true,true,true,true,true,false,false,true,false,false,false,false,false,false,true,true,true,true,true,true,false,false,false,false,false,false,false,true,false,false,true},
-            new boolean[]{false,true,true,true,true,true,true,false,true,false,false,false,false,false,false,true,false,false,false,true,false,false,false,false,true,true,true,true,true,false,false,true},
-            new boolean[]{false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,true,false,false,false,true,true,true,true,true,true,false,false,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,true,true,true},
-            new boolean[]{false,true,false,false,true,true,true,true,true,true,true,false,false,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,false,false,false,false},
-            new boolean[]{false,true,false,false,false,false,false,false,false,false,true,true,false,true,true,true,true,true,true,false,false,false,false,false,false,false,true,true,false,false,false,false},
-            new boolean[]{false,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true,false,false,false,false},
-            new boolean[]{true,true,true,false,false,false,true,true,true,true,true,true,true,true,false,false,true,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true,false,false,false,false},
-            new boolean[]{true,true,true,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,true,true,false,false,false,false,false,true,true,true,false,false,false,false},
-            new boolean[]{true,true,true,false,false,false,false,true,true,true,true,true,true,false,false,false,false,false,false,true,false,false,false,false,false,false,false,true,false,false,true,true},
-            new boolean[]{false,false,false,false,false,false,false,true,true,true,true,false,true,false,false,true,false,false,false,true,false,false,false,false,false,false,false,true,true,true,true,true},
-            new boolean[]{false,false,false,false,false,false,false,false,false,true,false,false,true,false,false,true,false,false,false,true,false,false,false,false,false,false,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,false,false,true,false,true,true,false,false,true,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,false,true,false,false,false,false,true,false,false,true,false,false,true,false,false,false,true,true,true,false,true,true,true,true,true,false,false,false,false},
-            new boolean[]{false,false,false,true,true,false,false,false,false,true,false,false,true,false,false,true,true,false,false,false,true,true,false,true,false,false,true,false,false,false,false,false},
-            new boolean[]{false,false,false,true,true,false,false,false,false,true,false,false,true,false,false,true,true,false,false,false,false,true,false,true,false,false,true,false,false,false,false,false},
-            new boolean[]{false,false,false,false,true,false,false,true,false,true,false,false,true,false,false,false,true,false,false,false,false,true,false,true,false,false,true,false,false,false,true,false},
-            new boolean[]{false,true,false,false,true,true,true,true,true,true,true,false,true,false,false,false,true,false,false,false,false,true,false,true,true,true,true,false,false,false,true,false},
-            new boolean[]{true,true,true,true,true,true,true,false,false,true,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,false,true,false,false,true,false,false,false,true,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true},
-            new boolean[]{false,false,false,false,false,false,true,false,false,true,false,false,true,false,false,false,false,true,false,false,true,true,false,false,false,false,false,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,true,false,false,true,true,true,true,true,false,false,false,false,false,false,true,true,false,false,false,false,true,true,true,false,false,false},
-            new boolean[]{false,false,false,false,false,false,true,false,false,false,false,true,true,true,false,false,false,false,false,false,true,true,false,false,false,false,true,true,true,false,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,true,true,true,false,false,false,false,false,false,true,true,true,false,false,false,true,true,true,true,true,true},
-            new boolean[]{false,false,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,false,false,true,false},
-            new boolean[]{false,false,false,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,true,true,true,false,false,false},
-            new boolean[]{false,false,false,false,false,false,false,true,true,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,true,true,true,false,false,false},
-            new boolean[]{false,true,false,false,false,false,false,true,true,false,false,false,false,false,false,true,true,true,true,false,false,false,false,false,true,true,true,true,true,true,true,true},
-    };
-
-    public static final boolean[][] openRooms = new boolean[][]{
-            new boolean[]{true,true,true,true,true,true,false,true,true,true,true,true,true,false,true,true,true,true,true,true,false,false,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,false,false,false,true,true,true,false,false,true,true,true,true,true,true,true,true,true,true,false,true,true,false,true,true,true,false,true,true},
-            new boolean[]{true,true,false,false,false,false,false,true,true,true,true,false,true,true,true,true,true,false,false,false,false,false,false,true,true,false,true,true,true,false,true,true},
-            new boolean[]{true,true,true,true,true,false,false,false,false,true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,false,true,true,true,false,false,false},
-            new boolean[]{true,true,true,true,true,false,false,false,false,true,true,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,true,true,true,true,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,true,true,true,true,true,true,false,true,true,true,true,true,true,true,false,false,false,false,false,false,true,true,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,false,true,true,true,true,false,false,false,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,false,false,true,true,true,true,false,false,false,true,true,true,true,true,false,true,true,true,true,false,false,false,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,true,true,true,true,false,false,false,false,false},
-            new boolean[]{true,true,true,true,true,false,true,true,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,true,true,true,true,false,false,false,false,false},
-            new boolean[]{false,false,false,false,false,false,true,true,false,true,true,true,false,false,false,true,true,true,true,true,true,true,false,true,true,true,true,true,true,true,false,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,true,true,true,false,false,false,false,true,true,true,true,true,true,false,true,true,true,true,true,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false,false,false,false,false,true,true,false,true,true,true,true,true,true,true,true,true},
-            new boolean[]{false,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false,false,false,false,false,true,true,false,false,false,false,false,false,false,true,true,false},
-            new boolean[]{false,true,true,false,false,false,false,false,true,true,true,true,true,true,true,false,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,false},
-            new boolean[]{false,true,true,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,true,true,true,false},
-            new boolean[]{false,true,true,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true,true,false,true,true,true,true,true,true,true,true,false},
-            new boolean[]{false,false,false,false,false,true,true,true,true,true,true,true,false,true,true,true,true,true,false,true,true,true,false,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,false,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false},
-            new boolean[]{true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,false,false,false,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,false,true,true,true,true,true,true,false,false,false,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,false,true,true,true,false,false,false,false,false,false,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,false,true,true,true,false,true,true,true,true,false,true,true,true,true},
-            new boolean[]{true,true,true,true,true,true,true,false,false,false,true,true,true,true,true,true,true,true,false,true,true,true,false,true,true,true,true,false,false,false,true,true},
-            new boolean[]{true,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,false,false,false,false,false,true,true,true,true,false,false,false,true,true},
-            new boolean[]{true,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true},
-            new boolean[]{true,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,true,true,true,true,true,true,true,true,true,true},
-            new boolean[]{true,false,false,false,false,false,false,true,true,true,true,true,true,false,false,false,false,false,true,true,false,false,true,true,true,true,true,true,true,true,true,true},
-    };
-
-    public static final boolean[][][] samples = new boolean[][][]{
-            boulders, cave, caves, chess, lessRooms, maze, quarterBlack,
-            river, rooms, simpleMaze, simpleRooms, thickWalls, ruins, openRooms
-    };
-}

+ 0 - 169
squidlib-util/src/main/java/squidpony/squidgrid/mapping/PacMazeGenerator.java

@@ -1,169 +0,0 @@
-package squidpony.squidgrid.mapping;
-
-import squidpony.GwtCompatibility;
-import squidpony.squidmath.RNG;
-
-/**
- * Meant to produce the sort of narrow, looping, not-quite-maze-like passages found in a certain famous early arcade game.
- * Created by Tommy Ettinger on 3/30/2016.
- */
-public class PacMazeGenerator {
-    public RNG rng;
-    public int width, height;
-    private boolean[][] map;
-    private int[][] env;
-    private char[][] maze;
-    public PacMazeGenerator()
-    {
-        this(250, 250);
-    }
-    public PacMazeGenerator(int width, int height)
-    {
-        this.height = height;
-        this.width = width;
-        rng = new RNG();
-    }
-    public PacMazeGenerator(int width, int height, RNG rng)
-    {
-        this.height = height;
-        this.width = width;
-        this.rng = rng;
-    }
-
-    private static final byte[] //unbiased_connections = new byte[]{3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15},
-            connections = new byte[]{
-                    3, 5, 6, 9, 10, 12,/*
-                    3, 5, 6, 9, 10, 12,
-                    3, 5, 6, 9, 10, 12,
-                    3, 5, 6, 9, 10, 12,
-                    7, 11, 13, 14,
-                    7, 11, 13, 14,
-                    15*/
-            };
-    private static final int connections_length = connections.length;
-    private boolean write(boolean[][] m, int x, int y, int xOffset, int yOffset, boolean value)
-    {
-        int nx = x * 3 + xOffset + 1, ny = y * 3 + yOffset + 1;
-        if(nx >= 0 && nx < m.length && ny >= 0 && ny < m[nx].length) {
-            m[nx][ny] = value;
-            return true;
-        }
-        return false;
-    }
-    public boolean[][] create()
-    {
-        map = new boolean[width][height];
-        byte[][] conns = new byte[(width+2) / 3][(height+2) / 3];
-        int xOff = (width % 3 == 1) ? -1 : 0, yOff = (height % 3 == 1) ? -1 : 0;
-        for (int x = 0; x < (width+2) / 3; x++) {
-            for (int y = 0; y < (height+2) / 3; y++) {
-                conns[x][y] = connections[rng.nextInt(connections_length)];
-            }
-        }
-        for (int x = 0; x < (width+2) / 3; x++) {
-            for (int y = 0; y < (height+2) / 3; y++) {
-                write(map, x, y, xOff, yOff, true);
-                if(x > 0 && ((conns[x - 1][y] & 1) != 0 || (conns[x][y] & 2) != 0))
-                {
-                    conns[x - 1][y] |= 1;
-                    conns[x][y] |= 2;
-                }
-                if(x < conns.length - 1 && ((conns[x + 1][y] & 2) != 0 || (conns[x][y] & 1) != 0))
-                {
-                    conns[x + 1][y] |= 2;
-                    conns[x][y] |= 1;
-                }
-                if(y > 0 && ((conns[x][y - 1] & 4) != 0 || (conns[x][y] & 8) != 0))
-                {
-                    conns[x][y - 1] |= 4;
-                    conns[x][y] |= 8;
-                }
-                if(y < conns[0].length - 1 && ((conns[x][y + 1] & 8) != 0 || (conns[x][y] & 4) != 0))
-                {
-                    conns[x][y + 1] |= 8;
-                    conns[x][y] |= 4;
-                }
-            }
-        }
-
-        for (int x = 1; x < (width-1) / 3; x++) {
-            for (int y = 1; y < (height-1) / 3; y++) {
-                if (Integer.bitCount(conns[x][y]) >= 4) {
-                    //byte temp = connections[rng.nextInt(connections_length)];
-                    int temp = 1 << rng.nextInt(4);
-                    conns[x][y] ^= temp;
-                    if((temp & 2) != 0) conns[x - 1][y] ^= 1;
-                    else if((temp & 1) != 0) conns[x + 1][y] ^= 2;
-                    else if((temp & 8) != 0) conns[x][y - 1] ^= 4;
-                    else if((temp & 4) != 0) conns[x][y + 1] ^= 8;
-                }
-            }
-        }
-        for (int x = 0; x < (width+2) / 3; x++) {
-            for (int y = 0; y < (height+2) / 3; y++) {
-                write(map, x, y, xOff, yOff, true);
-                if(x > 0 && (conns[x][y] & 2) != 0)
-                    write(map, x, y, xOff - 1, yOff, true);
-                if(x < conns.length - 1 && (conns[x][y] & 1) != 0)
-                    write(map, x, y, xOff + 1, yOff, true);
-                if(y > 0 && (conns[x][y] & 8) != 0)
-                    write(map, x, y, xOff, yOff - 1, true);
-                if(y < conns[0].length - 1 && (conns[x][y] & 4) != 0)
-                    write(map, x, y, xOff, yOff + 1, true);
-            }
-        }
-        int upperY = height - 1;
-        int upperX = width - 1;
-        for (int i = 0; i < width; i++) {
-            map[i][0] = false;
-            map[i][upperY] = false;
-        }
-        for (int i = 0; i < height; i++) {
-            map[0][i] = false;
-            map[upperX][i] = false;
-        }
-        return map;
-    }
-    public char[][] generate()
-    {
-        create();
-        maze = new char[width][height];
-        env = new int[width][height];
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                maze[x][y] = map[x][y] ? '.' : '#';
-                env[x][y] = map[x][y] ? MixedGenerator.CORRIDOR_FLOOR : MixedGenerator.CORRIDOR_WALL;
-            }
-        }
-
-        return maze;
-    }
-
-    public int[][] getEnvironment()
-    {
-        if(env == null)
-            return GwtCompatibility.fill2D(MixedGenerator.CORRIDOR_WALL, width, height);
-        return env;
-    }
-
-    /**
-     * Gets the maze as a 2D array of true for passable or false for blocked.
-     * @return a 2D boolean array; true is passable and false is not.
-     */
-    public boolean[][] getMap()
-    {
-        if(map == null)
-            return new boolean[width][height];
-        return map;
-    }
-
-    /**
-     * Gets the maze as a 2D array of ',' for passable or '#' for blocked.
-     * @return a 2D boolean array; '.' is passable and '#' is not.
-     */
-    public char[][] getMaze() {
-        if(maze == null)
-            return GwtCompatibility.fill2D('#', width, height);
-        return maze;
-    }
-}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1311
squidlib-util/src/main/java/squidpony/squidgrid/mapping/SectionDungeonGenerator.java


+ 0 - 578
squidlib-util/src/main/java/squidpony/squidgrid/mapping/ThinDungeonGenerator.java

@@ -1,578 +0,0 @@
-package squidpony.squidgrid.mapping;
-
-import squidpony.squidmath.PerlinNoise;
-import squidpony.squidmath.RNG;
-
-/**
- * Created by Tommy Ettinger on 8/7/2016.
- */
-public class ThinDungeonGenerator extends SectionDungeonGenerator {
-    public static final int
-            ROOM_WALL_RETRACT = 1, ROOM_WALL_NORMAL = 2, ROOM_WALL_EXPAND = 4, ROOM_WALL_CHAOTIC = 8,
-            CORRIDOR_WALL_RETRACT = 16, CORRIDOR_WALL_NORMAL = 32, CORRIDOR_WALL_EXPAND = 64, CORRIDOR_WALL_CHAOTIC = 128,
-            CAVE_WALL_RETRACT = 256, CAVE_WALL_NORMAL = 512, CAVE_WALL_EXPAND = 1024, CAVE_WALL_CHAOTIC = 2048;
-    public int wallShapes = ROOM_WALL_EXPAND | CORRIDOR_WALL_EXPAND | CAVE_WALL_CHAOTIC;
-
-    /**
-     * Make a DungeonGenerator with a LightRNG using a random seed, height 40, and width 40.
-     */
-    public ThinDungeonGenerator() {
-    }
-
-    /**
-     * Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and
-     * adding features will be a LightRNG using a random seed.
-     *
-     * @param width  The width of the dungeon in cells
-     * @param height The height of the dungeon in cells
-     */
-    public ThinDungeonGenerator(int width, int height) {
-        super(width, height);
-    }
-
-    /**
-     * Make a DungeonGenerator with the given height, width, and RNG. Use this if you want to seed the RNG.
-     *
-     * @param width  The width of the dungeon in cells
-     * @param height The height of the dungeon in cells
-     * @param rng    The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
-     */
-    public ThinDungeonGenerator(int width, int height, RNG rng) {
-        super(width, height, rng);
-    }
-
-    /**
-     * Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and
-     * adding features will be a LightRNG using a random seed. You can give the static fields of this class
-     * as arguments to roomShape, corridorShape and caveShape. For clarity, the 3 fields should each be given
-     * a constant corresponding to the same kind of area, e.g. ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be
-     * given to roomShape but preferably would not be given to the others. If the combination of arguments is
-     * invalid, such as if they are all 0, this uses the default shapes: expanded room and corridor walls, and
-     * chaotic cave walls controlled by Perlin noise.
-     * <br>
-     * Though there's no constructor that takes a single int which merges roomShape, corridorShape, and
-     * caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you
-     * made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the
-     * three shape arguments and 0 to the other two shapes; it will be processed in the same way.
-     *
-     * @param width         The width of the dungeon in cells
-     * @param height        The height of the dungeon in cells
-     * @param roomShape     expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTIC
-     * @param corridorShape expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTIC
-     * @param caveShape     expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTIC
-     */
-    public ThinDungeonGenerator(int width, int height, int roomShape, int corridorShape, int caveShape) {
-        super(width, height);
-        wallShapes = roomShape | corridorShape | caveShape;
-        if ((wallShapes & 0xF) == 0 || (wallShapes & 0xF0) == 0 || (wallShapes & 0xF00) == 0
-                || Integer.bitCount(wallShapes) != 3)
-            wallShapes = ROOM_WALL_EXPAND | CORRIDOR_WALL_EXPAND | CAVE_WALL_CHAOTIC;
-    }
-
-
-    /**
-     * Make a DungeonGenerator with the given height, width, and RNG for generating random features. You can
-     * give the static fields of this class as arguments to roomShape, corridorShape and caveShape. For
-     * clarity, the 3 fields should each be given a constant corresponding to the same kind of area, e.g.
-     * ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be given to roomShape but preferably would not be given to
-     * the others. If the combination of arguments is invalid, such as if they are all 0, this uses the default
-     * shapes: expanded room and corridor walls, and chaotic cave walls controlled by Perlin noise.
-     * <br>
-     * Though there's no constructor that takes a single int which merges roomShape, corridorShape, and
-     * caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you
-     * made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the
-     * three shape arguments and 0 to the other two shapes; it will be processed in the same way.
-     *
-     * @param width         The width of the dungeon in cells
-     * @param height        The height of the dungeon in cells
-     * @param roomShape     expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTIC
-     * @param corridorShape expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTIC
-     * @param caveShape     expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTIC
-     * @param rng           The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
-     */
-    public ThinDungeonGenerator(int width, int height, RNG rng, int roomShape, int corridorShape, int caveShape) {
-        super(width, height, rng);
-        wallShapes = roomShape | corridorShape | caveShape;
-        if ((wallShapes & 0xF) == 0 || (wallShapes & 0xF0) == 0 || (wallShapes & 0xF00) == 0
-                || Integer.bitCount(wallShapes) != 3)
-            wallShapes = ROOM_WALL_EXPAND | CORRIDOR_WALL_EXPAND | CAVE_WALL_CHAOTIC;
-    }
-
-    /**
-     * Copies all fields from copying and makes a new DungeonGenerator.
-     *
-     * @param copying the DungeonGenerator to copy
-     */
-    public ThinDungeonGenerator(ThinDungeonGenerator copying) {
-        super(copying);
-        wallShapes = copying.wallShapes;
-    }
-
-    public char[][] makeThin() {
-        int nw = (width << 1) - 1, nh = (height << 1) - 1;
-        char[][] d2 = new char[nw][nh];
-        int[][] e2 = new int[nw][nh];
-
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                d2[x * 2][y * 2] = dungeon[x][y];
-                e2[x * 2][y * 2] = finder.environment[x][y];
-            }
-        }
-        int eLow, eHigh;
-        char dLow, dHigh;
-        int tempShapes;
-        for (int y = 0; y < nh; y += 2) {
-            CELL_WISE:
-            for (int x = 1; x < nw-1; x += 2) {
-                eLow = e2[x - 1][y];
-                eHigh = e2[x + 1][y];
-                dLow = d2[x - 1][y];
-                dHigh = d2[x + 1][y];
-                tempShapes = wallShapes;
-                switch (eLow) {
-                    case MixedGenerator.CAVE_FLOOR:
-                        tempShapes >>= 4;
-                    case MixedGenerator.CORRIDOR_FLOOR:
-                        tempShapes >>= 4;
-                        break;
-                    default:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_FLOOR:
-                                tempShapes >>= 4;
-                            case MixedGenerator.CORRIDOR_FLOOR:
-                                tempShapes >>= 4;
-                        }
-                }
-                switch (tempShapes & 0xf) {
-                    case ROOM_WALL_NORMAL:
-                    case ROOM_WALL_RETRACT:
-                        if (y > 0 && y < nh - 1) {
-                            if ((dLow == '+') && (e2[x-1][y + 2] & 1) + (e2[x-1][y + 2] & 1) == 0) {
-                                d2[x][y] = dHigh;
-                                e2[x][y] = eHigh;
-                                d2[x-1][y-1] = '#';
-                                d2[x-1][y+1] = '#';
-                                e2[x-1][y-1] = 777;
-                                e2[x-1][y+1] = 777;
-                                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                    d2[x][y] = '\u0006';
-                                continue CELL_WISE;
-                            } /*else if ((dHigh == '+') && (e2[x+1][y - 2] & 1) + (e2[x+1][y - 2] & 1) == 0) {
-                                d2[x][y] = dLow;
-                                e2[x][y] = eLow;
-                                d2[x+1][y-1] = '#';
-                                d2[x+1][y+1] = '#';
-                                e2[x+1][y-1] = MixedGenerator.UNTOUCHED;
-                                e2[x+1][y+1] = MixedGenerator.UNTOUCHED;
-                                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                    d2[x][y] = '\u0006';
-                                continue CELL_WISE;
-                            }*/
-                        }
-                        break;
-                    case ROOM_WALL_EXPAND:
-                        if (y > 0 && y < nh - 1) {
-                            if ((dLow == '+') && ((e2[x - 1][y - 2] & 1) + (e2[x + 1][y - 2] & 1) != 0 || (e2[x - 1][y + 2] & 1) + (e2[x + 1][y + 2] & 1) != 0)) {
-                                d2[x][y] = dLow;
-                                e2[x][y] = eLow;
-                                d2[x - 1][y] = dHigh;
-                                e2[x - 1][y] = eHigh;
-                                continue CELL_WISE;
-                            } else if ((dHigh == '+') && ((e2[x - 1][y - 2] & 1) + (e2[x + 1][y - 2] & 1) != 0 || (e2[x - 1][y + 2] & 1) + (e2[x + 1][y + 2] & 1) != 0)) {
-                                d2[x][y] = dHigh;
-                                e2[x][y] = eHigh;
-                                d2[x + 1][y] = dLow;
-                                e2[x + 1][y] = eLow;
-                                continue CELL_WISE;
-                            }
-                        }
-                        break;
-                    case ROOM_WALL_CHAOTIC:
-                        if(dLow == '+')
-                        {
-                            d2[x - 1][y] = dHigh;
-                            e2[x - 1][y] = eHigh;
-                            if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                d2[x][y] = '\u0006';
-                            continue CELL_WISE;
-                        }
-                        else if(dHigh == '+')
-                        {
-                            d2[x + 1][y] = dLow;
-                            e2[x + 1][y] = eLow;
-                            if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                d2[x][y] = '\u0006';
-                            continue CELL_WISE;
-                        }
-                        break;
-                }
-                tempShapes = wallShapes;
-                switch (eLow) {
-                    case 777:
-                        d2[x][y] = '#';
-                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                        continue CELL_WISE;
-                    case MixedGenerator.CAVE_WALL:
-                    case MixedGenerator.CORRIDOR_WALL:
-                    case MixedGenerator.ROOM_WALL:
-                    case MixedGenerator.UNTOUCHED:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_WALL:
-                            case MixedGenerator.CORRIDOR_WALL:
-                            case MixedGenerator.ROOM_WALL:
-                            case MixedGenerator.UNTOUCHED:
-                                e2[x][y] = MixedGenerator.UNTOUCHED;
-                                d2[x][y] = dLow;
-                                break;
-                            case MixedGenerator.CAVE_FLOOR:
-                                tempShapes >>= 4;
-                            case MixedGenerator.CORRIDOR_FLOOR:
-                                tempShapes >>= 4;
-                            default:
-                                switch (tempShapes & 0xF) {
-                                    case ROOM_WALL_CHAOTIC:
-                                        if (PerlinNoise.noise(x * 0.8, y * 0.8) > -0.2) {
-                                            e2[x][y] = eHigh;
-                                            d2[x][y] = dHigh;
-                                        } else {
-                                            e2[x][y] = MixedGenerator.UNTOUCHED;
-                                            d2[x][y] = dLow;
-                                        }
-                                        break;
-                                    case ROOM_WALL_EXPAND:
-                                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                                        d2[x][y] = dLow;
-                                        break;
-                                    /*
-                                    case ROOM_WALL_RETRACT:
-                                        e2[x][y] = eHigh;
-                                        d2[x][y] = dHigh;
-                                        if(y > 1 && y < nh - 1 && (finder.environment[(x>>1)+1][y>>1] & 1) == 1) { // opposite cell is walkable, originally
-                                            e2[x - 1][y] = eHigh;
-                                            d2[x - 1][y] = dHigh;
-                                        }
-                                        break;*/
-                                    default:
-                                        e2[x][y] = eHigh;
-                                        d2[x][y] = dHigh;
-                                        break;
-                                }
-                                break;
-                        }
-                        break;
-                    case MixedGenerator.CAVE_FLOOR:
-                        tempShapes >>= 4;
-                    case MixedGenerator.CORRIDOR_FLOOR:
-                        tempShapes >>= 4;
-                    default:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_WALL:
-                            case MixedGenerator.CORRIDOR_WALL:
-                            case MixedGenerator.ROOM_WALL:
-                            case MixedGenerator.UNTOUCHED:
-                                switch (tempShapes & 0xF) {
-                                    case ROOM_WALL_CHAOTIC:
-                                        if (PerlinNoise.noise(x * 0.8, y * 0.8) > -0.2) {
-                                            e2[x][y] = eLow;
-                                            d2[x][y] = dLow;
-                                        } else {
-                                            e2[x][y] = MixedGenerator.UNTOUCHED;
-                                            d2[x][y] = dHigh;
-                                        }
-                                        break;
-                                    case ROOM_WALL_EXPAND:
-                                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                                        d2[x][y] = dHigh;
-                                        break;
-                                    /*
-                                    case ROOM_WALL_RETRACT:
-                                        e2[x][y] = eLow;
-                                        d2[x][y] = dLow;
-                                        if(y > 1 && y < nh - 1 && (finder.environment[(x>>1)-1][y>>1] & 1) == 1) { // opposite cell is walkable, originally
-                                            e2[x + 1][y] = eLow;
-                                            d2[x + 1][y] = dLow;
-                                        }
-                                        break;*/
-                                    default:
-                                        e2[x][y] = eLow;
-                                        d2[x][y] = dLow;
-                                        break;
-                                }
-                                break;
-                            case MixedGenerator.CAVE_FLOOR:
-                                e2[x][y] = MixedGenerator.CAVE_FLOOR;
-                                d2[x][y] = dHigh;
-                                break;
-                            default:
-                                e2[x][y] = eLow;
-                                d2[x][y] = dLow;
-                                break;
-                        }
-                        break;
-                }
-                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0) {
-                    d2[x][y] = '\u0006';
-                }
-            }
-        }
-        for (int x = 0; x < nw; x++) {
-            CELL_WISE:
-            for (int y = 1; y < nh-1; y += 2) {
-                eLow = e2[x][y - 1];
-                eHigh = e2[x][y + 1];
-                dLow = d2[x][y - 1];
-                dHigh = d2[x][y + 1];
-                tempShapes = wallShapes;
-                switch (eLow) {
-                    case MixedGenerator.CAVE_FLOOR:
-                        tempShapes >>= 4;
-                    case MixedGenerator.CORRIDOR_FLOOR:
-                        tempShapes >>= 4;
-                        break;
-                    default:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_FLOOR:
-                                tempShapes >>= 4;
-                            case MixedGenerator.CORRIDOR_FLOOR:
-                                tempShapes >>= 4;
-                        }
-                }
-                switch (tempShapes & 0xf) {
-                    case ROOM_WALL_NORMAL:
-                    case ROOM_WALL_RETRACT:
-                        if (x > 0 && x < nw - 1) {
-                            if(d2[x-1][y-1] == '+' || d2[x-1][y+1] == '+' ||d2[x+1][y-1] == '+' || d2[x+1][y+1] == '+') {
-                                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                    d2[x][y] = '\u0006';
-                                continue CELL_WISE;
-                            }
-                            else if ((dLow == '/') && (e2[x - 2][y - 1] & 1) + (e2[x - 2][y + 1] & 1) == 0) {
-                                d2[x][y] = dHigh;
-                                e2[x][y] = eHigh;
-                                d2[x-1][y-1] = '#';
-                                d2[x+1][y-1] = '#';
-                                e2[x-1][y-1] = MixedGenerator.UNTOUCHED;
-                                e2[x+1][y-1] = MixedGenerator.UNTOUCHED;
-                                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                    d2[x][y] = '\u0006';
-                                continue CELL_WISE;
-                            } else if ((dHigh == '/') && (e2[x - 2][y + 1] & 1) + (e2[x + 2][y + 1] & 1) == 0) {
-                                d2[x][y] = dLow;
-                                e2[x][y] = eLow;
-                                d2[x-1][y+1] = '#';
-                                d2[x+1][y+1] = '#';
-                                e2[x-1][y+1] = MixedGenerator.UNTOUCHED;
-                                e2[x+1][y+1] = MixedGenerator.UNTOUCHED;
-                                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                    d2[x][y] = '\u0006';
-                                continue CELL_WISE;
-                            }
-                        }
-                        break;
-                    case ROOM_WALL_EXPAND:
-                        if (x > 0 && x < nw - 1) {
-                            if ((dLow == '/') && ((e2[x - 1][y - 1] & 1) + (e2[x - 1][y + 1] & 1) != 0 || (e2[x + 1][y - 1] & 1) + (e2[x + 1][y + 1] & 1) != 0)) {
-                                d2[x][y] = dLow;
-                                e2[x][y] = eLow;
-                                d2[x][y - 1] = dHigh;
-                                e2[x][y - 1] = eHigh;
-                                continue CELL_WISE;
-                            } else if ((dHigh == '/') && ((e2[x - 1][y - 1] & 1) + (e2[x - 1][y + 1] & 1) != 0 || (e2[x + 1][y - 1] & 1) + (e2[x + 1][y + 1] & 1) != 0)) {
-                                d2[x][y] = dHigh;
-                                e2[x][y] = eHigh;
-                                d2[x][y + 1] = dLow;
-                                e2[x][y + 1] = eLow;
-                                continue CELL_WISE;
-                            }
-                        }
-                        break;
-                    case ROOM_WALL_CHAOTIC:
-                        if(dLow == '/')
-                        {
-                            d2[x][y-1] = dHigh;
-                            e2[x][y-1] = eHigh;
-                            if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                d2[x][y] = '\u0006';
-                            continue CELL_WISE;
-                        }
-                        else if(dHigh == '/')
-                        {
-                            d2[x][y+1] = dLow;
-                            e2[x][y+1] = eLow;
-                            if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0)
-                                d2[x][y] = '\u0006';
-                            continue CELL_WISE;
-                        }
-                        break;
-                }
-                tempShapes = wallShapes;
-
-                switch (eLow) {
-                    case 777:
-                        d2[x][y] = '#';
-                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                        break;
-                    case MixedGenerator.CAVE_WALL:
-                    case MixedGenerator.CORRIDOR_WALL:
-                    case MixedGenerator.ROOM_WALL:
-                    case MixedGenerator.UNTOUCHED:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_WALL:
-                            case MixedGenerator.CORRIDOR_WALL:
-                            case MixedGenerator.ROOM_WALL:
-                            case MixedGenerator.UNTOUCHED:
-                                e2[x][y] = MixedGenerator.UNTOUCHED;
-                                d2[x][y] = dLow;
-                                break;
-                            case MixedGenerator.CAVE_FLOOR:
-                                tempShapes >>= 4;
-                            case MixedGenerator.CORRIDOR_FLOOR:
-                                tempShapes >>= 4;
-                            default:
-                                switch (tempShapes & 0xF) {
-                                    case ROOM_WALL_CHAOTIC:
-                                        if (PerlinNoise.noise(x * 0.8, y * 0.8) > -0.2) {
-                                            e2[x][y] = eHigh;
-                                            d2[x][y] = dHigh;
-                                        } else {
-                                            e2[x][y] = MixedGenerator.UNTOUCHED;
-                                            d2[x][y] = dLow;
-                                        }
-                                        break;
-                                    case ROOM_WALL_EXPAND:
-                                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                                        d2[x][y] = dLow;
-                                        break;
-                                    /*
-                                    case ROOM_WALL_RETRACT:
-                                        e2[x][y] = eHigh;
-                                        d2[x][y] = dHigh;
-                                        if(x > 1 && x < nw - 1 && (finder.environment[x>>1][(y>>1)+1] & 1) == 1) { // opposite cell is walkable, originally
-                                            e2[x][y-1] = eHigh;
-                                            d2[x][y-1] = dHigh;
-                                        }
-                                        break;*/
-                                    default:
-                                        e2[x][y] = eHigh;
-                                        d2[x][y] = dHigh;
-                                        break;
-                                }
-                                break;
-                        }
-                        break;
-                    case MixedGenerator.CAVE_FLOOR:
-                        tempShapes >>= 4;
-                    case MixedGenerator.CORRIDOR_FLOOR:
-                        tempShapes >>= 4;
-                    default:
-                        switch (eHigh) {
-                            case MixedGenerator.CAVE_WALL:
-                            case MixedGenerator.CORRIDOR_WALL:
-                            case MixedGenerator.ROOM_WALL:
-                            case MixedGenerator.UNTOUCHED:
-                                switch (tempShapes & 0xF) {
-                                    case ROOM_WALL_CHAOTIC:
-                                        if (PerlinNoise.noise(x * 0.8, y * 0.8) > -0.2) {
-                                            e2[x][y] = eLow;
-                                            d2[x][y] = dLow;
-                                        } else {
-                                            e2[x][y] = MixedGenerator.UNTOUCHED;
-                                            d2[x][y] = dHigh;
-                                        }
-                                        break;
-                                    case ROOM_WALL_EXPAND:
-                                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                                        d2[x][y] = dHigh;
-                                        break;
-                                    /*
-                                    case ROOM_WALL_RETRACT:
-                                        e2[x][y] = eLow;
-                                        d2[x][y] = dLow;
-                                        if(x > 1 && x < nw - 1 && (finder.environment[x>>1][(y>>1)-1] & 1) == 1) { // opposite cell is walkable, originally
-                                            e2[x][y+1] = eLow;
-                                            d2[x][y+1] = dLow;
-                                        }
-                                        break;*/
-                                    default:
-                                        e2[x][y] = eLow;
-                                        d2[x][y] = dLow;
-                                        break;
-                                }
-                                break;
-                            case MixedGenerator.CAVE_FLOOR:
-                                e2[x][y] = MixedGenerator.CAVE_FLOOR;
-                                d2[x][y] = dHigh;
-                                break;
-                            default:
-                                e2[x][y] = eLow;
-                                d2[x][y] = dLow;
-                                break;
-                        }
-                        break;
-                }
-
-                if (e2[x][y] != MixedGenerator.UNTOUCHED || d2[x][y] == 0) {
-                    d2[x][y] = '\u0006';
-                }
-            }
-        }
-
-        for (int x = 1; x < nw - 1; x += 2) {
-            for (int y = 1; y < nh - 1; y += 2) {
-                if (d2[x - 1][y] == '#' && d2[x + 1][y] == '#') {
-                    e2[x][y] = MixedGenerator.UNTOUCHED;
-                    d2[x][y] = '#';
-                }
-            }
-        }
-        for (int x = 1; x < nw - 1; x++) {
-            for (int y = 1; y < nh - 1; y += 2) {
-                if (e2[x][y - 1] == MixedGenerator.UNTOUCHED || e2[x][y + 1] == MixedGenerator.UNTOUCHED) {
-                    if (e2[x - 1][y] == MixedGenerator.UNTOUCHED) {
-                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                        d2[x][y] = '#';
-                    } else if (e2[x + 1][y] == MixedGenerator.UNTOUCHED) {
-                        e2[x][y] = MixedGenerator.UNTOUCHED;
-                        d2[x][y] = '#';
-                    }
-                }
-            }
-        }
-
-        dungeon = d2;
-        width = nw;
-        height = nh;
-        if (stairsUp != null) {
-            stairsUp = stairsUp.multiply(2);
-        }
-        if (stairsDown != null) {
-            stairsDown = stairsDown.multiply(2);
-        }
-        finder = new RoomFinder(dungeon, e2);
-        placement = new Placement(finder);
-        return dungeon;
-    }
-
-    @Override
-    protected char[][] innerGenerate() {
-        super.innerGenerate();
-        makeThin();
-        return dungeon;
-    }
-
-    /**
-     * Provides a string representation of the latest generated dungeon.
-     * Because the spaces between occupy-able cells, when walkable, use the control character U+0006
-     * to indicate that they're not meant to be displayed, this replaces any instances of that character
-     * in the printable output with ordinary space characters, while keeping the internal representation
-     * as the control character.
-     *
-     * @return a printable string version of the latest generated dungeon.
-     */
-    @Override
-    public String toString() {
-        return super.toString().replace('\u0006', ' ');
-    }
-
-}

+ 0 - 15
squidlib-util/src/main/java/squidpony/squidgrid/mapping/TiledLevel.java

@@ -1,15 +0,0 @@
-package squidpony.squidgrid.mapping;
-
-import squidpony.annotation.Beta;
-
-/**
- * Holds a single level.
- *
- * Currently empty awaiting future mapping developments.
- *
- * @author Eben Howard - http://squidpony.com - howard@squidpony.com
- */
-@Beta
-public class TiledLevel {
-
-}