diff options
Diffstat (limited to 'aoc2023-other/day-14/day-14.rkt')
-rw-r--r-- | aoc2023-other/day-14/day-14.rkt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/aoc2023-other/day-14/day-14.rkt b/aoc2023-other/day-14/day-14.rkt index e90feba..d0b7cad 100644 --- a/aoc2023-other/day-14/day-14.rkt +++ b/aoc2023-other/day-14/day-14.rkt @@ -15,15 +15,21 @@ (~> col (chunks-by (curry equal? #\#)) (append-map (curryr sort char>?) _)))) (define (score board) - (for*/sum ([col (in-list board)] [(row n) (in-indexed (reverse col))] #:when (equal? row #\O)) + (for*/sum ([col (in-list board)] + [(row n) (in-indexed (reverse col))] + #:when (equal? row #\O)) (add1 n))) ;; part 1 -(~> input roll-boulders score) +(~> input + roll-boulders + score) ;; part 2 (define (rotate-board xss) - (~> xss (map reverse _) transpose)) + (~> xss + (map reverse _) + transpose)) (define (full-cycle board) (foldl (λ (_ acc) (~> acc roll-boulders rotate-board)) board (range 4))) |