Jump to content

Maze generation: Difference between revisions

More readable D code
(Simpler D version)
(More readable D code)
Line 814:
enum int w = 16, h = 8;
alias std.array.replicate R;
auto horvis = array(map!((_){new return R(bool["+--"][](h, w); })(iota(h+1)));,
auto ver hor = array(map!((_){ return R(["| +--"], w)~"|"; })(iota(h + 1)));,
auto vis ver = newarray(map!((_){ boolreturn R(["| "][](h, w) ~ "|"; })(iota(h)));
 
void walk(in int x, in int y) /*nothrow*/ {
Line 830:
}
}
 
walk(uniform(0, w), uniform(0, h));
foreach (a, b; lockstep(hor, ver ~ []))
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.