fixup! day 10 WIP

This commit is contained in:
Aleh Suprunovich 2024-12-12 21:27:08 +03:00
parent 8695b8b375
commit bdd2a03230

View File

@ -3,8 +3,6 @@
[helpers :refer [get-input]]))
(def test-map
(mapped-area/parse-elements
(mapped-area/read-mapped-area
"89010123
78121874
87430965
@ -12,7 +10,19 @@
45678903
32019012
01329801
10456732")))
10456732")
;(def test-map
;"0123
;1234
;8765
;9876")
(def input
(->
test-map
mapped-area/read-mapped-area
mapped-area/parse-elements))
(defn trailheads [a]
(reduce
@ -42,6 +52,15 @@
(count positions)
(recur (mapcat (partial step a) (set positions))))))
(loop [i 0 positions (trailheads input)]
(println "iteration" i)
(doall
(map #(println % "-" (get-in input %)) positions))
(if (== i 9)
positions
(recur (inc i)
(mapcat (partial step input) positions))))
(reduce +
(map (partial walk test-map) (trailheads test-map)))
(trailheads input)
(mapcat (partial step input) (trailheads input))