From b7817b4c9680ec2fdc021b17a8d3f4fbee2929d5 Mon Sep 17 00:00:00 2001 From: HJ Date: Sun, 10 Dec 2023 09:35:47 -0500 Subject: day 10 racket complete --- aoc2023-other/day-10/day-10.rkt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/aoc2023-other/day-10/day-10.rkt b/aoc2023-other/day-10/day-10.rkt index f9255bc..feaff64 100644 --- a/aoc2023-other/day-10/day-10.rkt +++ b/aoc2023-other/day-10/day-10.rkt @@ -80,13 +80,13 @@ #:break (not (hash-has-key? grid test-pt)) #:when (set-member? pipes test-pt)) (define pipe (hash-ref grid test-pt)) - (match* (pipe corner) - [(#\| #f) (values (add1 acc) #f)] ; vertical crossing - [((or #\F #\L) #f) (values acc pipe)] - [(#\J #\F) (values (add1 acc) #f)] ; a ┏━┛ shape counts as a vertical crossing - [(#\7 #\L) (values (add1 acc) #f)] - [(#\7 #\F) (values acc #f)] ; a ┏━┓ shape doesn't count - [(#\J #\L) (values acc #f)] + (match* (corner pipe) + [(#f #\|) (values (add1 acc) #f)] ; vertical crossing + [(#f (or #\F #\L)) (values acc pipe)] + [(#\F #\J) (values (add1 acc) #f)] ; a ┏━┛ shape counts as a vertical crossing + [(#\L #\7) (values (add1 acc) #f)] + [(#\F #\7) (values acc #f)] ; a ┏━┓ shape doesn't count + [(#\L #\J) (values acc #f)] [(_ _) (values acc corner)]))) (~> pipe-grid hash-keys (count (λ~> (trace-rays pipe-loop-set pipe-grid)) _)) -- cgit v1.2.3