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