Maze generation: Difference between revisions

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


=={{header|Perl}}==
=={{header|Perl}}==