Anonymous user
Maze generation: Difference between revisions
Simpler D entry
(Updated D entry) |
(Simpler D entry) |
||
Line 1,553:
import std.stdio, std.algorithm, std.range, std.random;
enum
auto vis = new bool[][](h, w),
hor = iota(h + 1).map!(_ => ["+---"].replicate(w)).array,
ver = h.iota.map!(_ => ["| "].replicate(w) ~ "|").array;
void walk(in
vis[y][x] = true;
foreach (p; [[x-1,y], [x,y+1], [x+1,y], [x,y-1]].randomCover) {
if (p
}
}
|