Maze generation: Difference between revisions

→‎{{header|TXR}}: Do not pass unused variables through recursion. Use special variables to avoid passing down hashes.
(→‎{{header|TXR}}: Regen output.)
(→‎{{header|TXR}}: Do not pass unused variables through recursion. Use special variables to avoid passing down hashes.)
Line 4,677:
@(do
(defvar *r* (make-random-state nil))
(defvar vi)
(defvar pa)
 
(defun scramble (list)
Line 4,685 ⟶ 4,687:
out))
 
(defun make-maze-recneigh (w h vi pa culoc)
(tree-bind (x . y) loc
(list (- x 1)..y (+ x 1)..y
x..(make-maze-rec wy h1) vix..(+ pay ne))1))))
 
(defun make-maze-rec (cu)
(set [vi cu] t)
(let*each ((xne (carscramble (neigh cu)) (y (cdr cu))
(adjcond (list (- x 1)..y (+not x[vi 1ne])..y
x..(-push y 1) x..(+ne y[pa 1)))cu])
(each ((ne (scramblepush adj))cu [pa ne])
(cond ((not [vi (make-maze-rec ne])))))
(push ne [pa cu])
(push cu [pa ne])
(make-maze-rec w h vi pa ne))))))
 
(defun make-maze (w h)
Line 4,705 ⟶ 4,709:
(set [vi -1..y] t)
(set [vi w..y] t))
(make-maze-rec w h vi pa 0..0)
pa))
 
543

edits