private static IHeightMap GenerateRocks(int seed, int x, int y, double density) { CellularAutomaton ca = new CellularAutomaton(seed, new RuleSet(Lerp(0.1, 0.3, density), false, (region, generation) => region.GetNeighbors() > 2)); IHeightMap layer1 = new BooleanMap(ca.Generate(x, y, 4)); IHeightMap layer2 = new BooleanMap(ca.Generate(x, y, 2)); return(new HeightMap(2, ValueArray.Create(x, y, (i, j) => layer1[i, j] + layer2[i, j]))); }
private static bool[,] GenerateWalls(int seed, int x, int y, double density) { CellularAutomaton ca = new CellularAutomaton(seed, new RuleSet(Lerp(0.35, 0.5, density), true, (region, generation) => region.GetNeighbors() > 4)); return(ca.Generate(x, y, 11)); }