aboutsummaryrefslogtreecommitdiff
path: root/aoc2023-other/day-17/day-17.rkt
diff options
context:
space:
mode:
authorHJ <thechairman@thechairman.info>2023-12-25 11:24:39 -0500
committerHJ <thechairman@thechairman.info>2023-12-25 11:24:39 -0500
commit40eb8465f7958ac056a3843d38234848b15464f7 (patch)
tree6a22b862107f219c6b1c354c4ac70792e9d41ce8 /aoc2023-other/day-17/day-17.rkt
parentf3dfb53b1d59febe1f3bac746150372362f313a9 (diff)
downloadgleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.tar.gz
gleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.zip
day 1-24 end-of-year style cleanup
Diffstat (limited to 'aoc2023-other/day-17/day-17.rkt')
-rw-r--r--aoc2023-other/day-17/day-17.rkt11
1 files changed, 7 insertions, 4 deletions
diff --git a/aoc2023-other/day-17/day-17.rkt b/aoc2023-other/day-17/day-17.rkt
index 7d8c108..05709ad 100644
--- a/aoc2023-other/day-17/day-17.rkt
+++ b/aoc2023-other/day-17/day-17.rkt
@@ -4,8 +4,8 @@
threading
data/heap)
-(struct state (p heat-lost previous history) #:transparent)
-(struct posn (r c) #:transparent)
+(struct state (p heat-lost previous history))
+(struct posn (r c))
(define/match (add _p1 _p2)
[((posn r1 c1) (posn r2 c2)) (posn (+ r1 r2) (+ c1 c2))])
@@ -25,11 +25,14 @@
(cons (state-p s) (same-dir s)))
(define (goal? n s)
- (and (equal? goal-posn (state-p s)) (>= (length (same-dir s)) n)))
+ (and (equal? goal-posn (state-p s))
+ (>= (length (same-dir s)) n)))
(define (same-dir s)
(define history (state-history s))
- (if (empty? history) '() (takef history (λ (n) (equal? n (car history))))))
+ (if (empty? history)
+ '()
+ (takef history (λ (n) (equal? n (car history))))))
(define (find-good-neighbors min-dist max-dist s)
(match-define (state p hl prev hist) s)