Maze generation: Difference between revisions

Simpler D entry
(Simpler D entry)
(Simpler D entry)
Line 991:
 
=={{header|D}}==
{{trans|Python}}
<lang d>import std.stdio, std.algorithm, std.range, std.random, std.string;
 
Line 1,005 ⟶ 1,004:
static struct P { uint x, y; } // will wrap-around
auto d = [P(x-1, y), P(x, y+1), P(x+1, y), P(x, y-1)];
foreach (p; d.randomCover(Random(unpredictableSeed))) {
d.randomShuffle();
foreach (p; d) {
if (p.x >= w || p.y >= h || vis[p.y][p.x]) continue;
if (p.x == x) hor[max(y, p.y)][x] = "+ ";