diff options
author | HJ <thechairman@thechairman.info> | 2023-12-10 09:35:47 -0500 |
---|---|---|
committer | HJ <thechairman@thechairman.info> | 2023-12-10 09:35:47 -0500 |
commit | b7817b4c9680ec2fdc021b17a8d3f4fbee2929d5 (patch) | |
tree | 0c33f783769525504f43de92b212afa58392a677 /aoc2023-other | |
parent | 0390b6e1e49925ce12cc4e30ece616a12d668e02 (diff) | |
download | gleam_aoc-b7817b4c9680ec2fdc021b17a8d3f4fbee2929d5.tar.gz gleam_aoc-b7817b4c9680ec2fdc021b17a8d3f4fbee2929d5.zip |
day 10 racket complete
Diffstat (limited to 'aoc2023-other')
-rw-r--r-- | aoc2023-other/day-10/day-10.rkt | 14 |
1 files 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)) _)) |