aboutsummaryrefslogtreecommitdiff
path: root/aoc2023-other/day-17/day-17.rkt
diff options
context:
space:
mode:
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)