Maze generation: Difference between revisions

m
m (→‎simpler version of above: updated the output.)
Line 4,453:
; maze printing:
(display "+")
(for-each (lambda (?) (display "--+")) (iota WIDTH))
(print)
(for-each (lambda (l)
; left wall (always)
(display "|")
; draw right wall
(for-each (lambda (x)
(display " ")
(display (if (zero? (band x #b10)) " " "|")))
l)
(print)
(display "+")
; draw bottom wall
(for-each (lambda (x)
(display (if (zero? (band x #b01)) " " "--"))
(display "+"))
l)
Line 4,472 ⟶ 4,475:
</lang>
{{out|Sample 30 x 8 output}}
<pre>+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| | | | | | | | | |
+ + + + +--+ +--+ + +--+ +--+ +--+--+ +--+ +--+ +--+ + +--+ +--+ + +--+ +
| | | | | | | | | | | | | | | | | | |
+--+ + +--+ +--+ + + + + + +--+--+--+ + +--+ +--+ + +--+ +--+ +--+ + + +
| | | | | | | | | | | | | | | | | | | |
+ +--+--+--+--+ + +--+--+ +--+ + +--+--+--+ + +--+ + +--+ +--+ +--+ + + + +
| | | | | | | | | | | | | | |
+--+ + +--+ +--+--+--+--+ + +--+ +--+--+ + +--+--+ + + +--+--+ + +--+--+ + +
| | | | | | | | | | | | | | | | | | | | |
+ +--+ + + + + + + +--+ + +--+--+ + +--+ + +--+ + + + + +--+ +--+--+--+
| | | | | | | | | | | | | | | | | |
+--+ + + +--+--+ +--+--+ +--+ +--+ +--+--+ +--+--+--+--+--+--+ + + + + +--+ +
| | | | | | | | | | | | | | |
+ +--+--+--+--+ + + + + +--+--+ +--+ +--+--+--+--+ +--+--+ + + + +--+--+ + +
| | | | | | | |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</pre>
 
=={{header|Perl}}==