Enter a demo mode, generating lots of levels

This commit is contained in:
Pyrex 2023-09-19 21:13:31 -07:00
parent 508fd28f04
commit 04b580b22c

View File

@ -26,33 +26,39 @@ void main() async {
at(0, 0).clear(); at(0, 0).clear();
at(0, 0).puts("Loaded! $vaults"); at(0, 0).puts("Loaded! $vaults");
Vault output = vaults.generateBoxed( int seed = 0;
math.Random(2),
Requirement( while (true) {
16, Vault output = vaults.generateBoxed(
16, math.Random(seed),
DirectionSet({ Requirement(
Direction.up, 16,
Direction.left, 16,
Direction.right, DirectionSet({
Direction.down Direction.up,
}))); Direction.left,
var w = output.vx; Direction.right,
var h = output.vy; Direction.down
for (var y = 0; y < w; y++) { })));
for (var x = 0; x < h; x++) { var w = output.vx;
var cursor = at(x * 2, y * 2).big(); var h = output.vy;
switch (output.tiles[x + y * w]) { for (var y = 0; y < w; y++) {
case LevelTile.floor: for (var x = 0; x < h; x++) {
cursor.puts(" "); var cursor = at(x * 2, y * 2).big();
case LevelTile.door: switch (output.tiles[x + y * w]) {
cursor.puts("d"); case LevelTile.floor:
case LevelTile.wall: cursor.puts(" ");
cursor.puts("#"); case LevelTile.door:
case LevelTile.exit: cursor.puts("d");
cursor.puts("X"); case LevelTile.wall:
cursor.puts("#");
case LevelTile.exit:
cursor.puts("X");
}
} }
} }
seed += 1;
await zzz(0.1);
} }
} }
/* /*