aboutsummaryrefslogtreecommitdiff
path: root/2022
diff options
context:
space:
mode:
authorHunky Jimpjorps <thechairman@thechairman.info>2022-12-14 10:47:10 -0500
committerHunky Jimpjorps <thechairman@thechairman.info>2022-12-14 10:47:10 -0500
commit1765de8f51c0041c38423715308e4e6cec556564 (patch)
tree746dd2603a7860ea6669dad937b02aa1f9287c40 /2022
parent8b4300ef235cc6bcb812fcf1226aadb01edecd7b (diff)
downloadgleam_aoc-1765de8f51c0041c38423715308e4e6cec556564.tar.gz
gleam_aoc-1765de8f51c0041c38423715308e4e6cec556564.zip
day 12 tweaks
Diffstat (limited to '2022')
-rw-r--r--2022/day-12/day-12.rkt12
1 files changed, 6 insertions, 6 deletions
diff --git a/2022/day-12/day-12.rkt b/2022/day-12/day-12.rkt
index ed93453..c3f01ac 100644
--- a/2022/day-12/day-12.rkt
+++ b/2022/day-12/day-12.rkt
@@ -23,16 +23,16 @@
(for*/list ([dx (in-list '(-1 0 1))]
[dy (in-list '(-1 0 1))]
#:when (= 1 (abs (+ dx dy)))
- #:do [(define p (cons (+ x dx) (+ y dy)))]
- #:when (hash-has-key? terrain-mesh p))
- p))
+ #:do [(define p* (cons (+ x dx) (+ y dy)))]
+ #:when (hash-has-key? terrain-mesh p*))
+ p*))
(define paths
(directed-graph (for*/list ([p (in-list (hash-keys terrain-mesh))]
- [neighbor (in-list (neighbors p))]
- #:unless (> (sub1 (hash-ref terrain-mesh neighbor))
+ [p* (in-list (neighbors p))]
+ #:unless (> (sub1 (hash-ref terrain-mesh p*))
(hash-ref terrain-mesh p)))
- (list p neighbor))))
+ (list p p*))))
;; part 1
(time (match-define-values (distances _) (bfs paths (hash-ref special-points 'start)))