Maze generation: Difference between revisions

m
→‎{{header|D}}: added start and end
m (→‎{{header|D}}: added start and end)
Line 109:
 
void print() {
maze[0][0].m &= ~north;
maze[h-1][w-1].m &= ~east;
 
for (int r = 0; r < h; r++) {
auto hori = appender("");
auto vert = appender("");
for (int c; c < w; c++) {
if (maze[cr][rc].m & north) {
if (c == w - 1) hori.put("+---+"); else hori.put("+---");
} else {
if (c == w - 1) hori.put("+ +"); else hori.put("+ ");
}
if (maze[cr][rc].m & westeast) {
if (c == w - 10) vert.put("| |"); else vert.put("| |");
} else {
if (c == w - 10) vert.put("| |"); else vert.put(" ");
}
}
Line 131 ⟶ 134:
}</lang>
 
<pre>+--- +---+---+---+---+---+---+---+---+---+---+
| | | | | |
+--- +---+--- + +---+ + ---+---+---+ + +
| | | | | | | | |
+ +--- +---+---+ +---+---+---+ +---+---+ +
| | | | | | | |
+---+ +---+---+---+---+---+ + + + ---+---+
| | | | | | |
+ ---+ + +---+ +---+ + ---+ ---+---+---+ +
| | | | | | | | |
+ + +---+ ---+ ---+ + + ---+---+---+ ---+
| | | | | | | |
+ +---+ +---+--- + +---+---+ + + +
| | | | | | | |
+ + +---+ + + +---+ + +---+---+ +
| | | | |
+---+---+---+---+---+---+---+---+---+---+---+</pre>
 
Anonymous user