diff options
author | Paul A. Patience <paul@apatience.com> | 2021-07-04 23:38:07 -0400 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-05 14:35:49 -0700 |
commit | c656cf912e32f394a525d970bce7b08e47f06333 (patch) | |
tree | 28e2a10ea4a44cb3500e7ad5a8fb0df4a6c67e57 /tests/013/maze.tl | |
parent | b632bc645ba4fc72e1434cf58327b653bbf73c5b (diff) | |
download | txr-c656cf912e32f394a525d970bce7b08e47f06333.tar.gz txr-c656cf912e32f394a525d970bce7b08e47f06333.tar.bz2 txr-c656cf912e32f394a525d970bce7b08e47f06333.zip |
genman, lib, tests: use defvarl where possible.
* genman.txr (dupes, tagnum): Replace defvar with defvarl.
* stdlib/doc-lookup.tl (os-symbol): Same.
* tests/011/macros-3.tl (x): Same.
* tests/011/mandel.txr (x-centre, y-centre, width, i-max, j-max, n)
(r-max, pixel-size, x-offset, y-offset): Same.
(file, colour-max): Delete (unused) variables.
* tests/012/circ.tl (x): Replace defvar with defvarl.
* tests/012/stack.tl (stack-limited): Same.
* tests/012/struct.tl (s): Same.
* tests/013/maze.tl (vi, pa, sc): Delete variables. Use
function arguments instead.
(usage): Fix typo.
* tests/014/dgram-stream.tl (family): Rename to...
(*family*): ...this.
* tests/014/socket-basic.tl (socktype): Rename to...
(*socktype*): ...this.
(%iters%): Replace defvar with defvarl.
Diffstat (limited to 'tests/013/maze.tl')
-rw-r--r-- | tests/013/maze.tl | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/013/maze.tl b/tests/013/maze.tl index 5cb989d6..38dca3e3 100644 --- a/tests/013/maze.tl +++ b/tests/013/maze.tl @@ -1,7 +1,3 @@ -(defvar vi) ;; visited hash -(defvar pa) ;; path connectivity hash -(defvar sc) ;; count, derived from straightness fator - (defun scramble (list) (let ((out ())) (each ((item list)) @@ -18,7 +14,7 @@ (list (- x 1)..y (+ x 1)..y x..(- y 1) x..(+ y 1)))) -(defun make-maze-impl (cu) +(defun make-maze-impl (vi pa sc cu) (let ((fr (hash :equal-based)) (q (list cu)) (c sc)) @@ -38,16 +34,16 @@ (pop q))))))) (defun make-maze (w h sf) - (let ((vi (hash :equal-based)) - (pa (hash :equal-based)) - (sc (max 1 (int-flo (trunc (* sf w h) 100.0))))) + (let ((vi (hash :equal-based)) ;; visited hash + (pa (hash :equal-based)) ;; path connectivity hash + (sc (max 1 (int-flo (trunc (* sf w h) 100.0))))) ;; go straight count (each ((x (range -1 w))) (set [vi x..-1] t) (set [vi x..h] t)) (each ((y (range* 0 h))) (set [vi -1..y] t) (set [vi w..y] t)) - (make-maze-impl 0..0) + (make-maze-impl vi pa sc 0..0) ;; Open start and end (push 0..-1 [pa 0..0]) (push (- w 1)..(- h 1) [pa (- w 1)..h]) @@ -78,7 +74,7 @@ (let ((invocation (ldiff *full-args* *args*))) (put-line "usage: ") (put-line `@invocation <width> <height> [<straightness>]`) - (put-line "straightness-factor is a percentage, defaulting to 15") + (put-line "straightness is a percentage, defaulting to 15") (exit 1))) (let ((args [mapcar num-str *args*])) |