fixup! day 10 WIP
This commit is contained in:
parent
8695b8b375
commit
bdd2a03230
@ -3,8 +3,6 @@
|
|||||||
[helpers :refer [get-input]]))
|
[helpers :refer [get-input]]))
|
||||||
|
|
||||||
(def test-map
|
(def test-map
|
||||||
(mapped-area/parse-elements
|
|
||||||
(mapped-area/read-mapped-area
|
|
||||||
"89010123
|
"89010123
|
||||||
78121874
|
78121874
|
||||||
87430965
|
87430965
|
||||||
@ -12,7 +10,19 @@
|
|||||||
45678903
|
45678903
|
||||||
32019012
|
32019012
|
||||||
01329801
|
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]
|
(defn trailheads [a]
|
||||||
(reduce
|
(reduce
|
||||||
@ -42,6 +52,15 @@
|
|||||||
(count positions)
|
(count positions)
|
||||||
(recur (mapcat (partial step a) (set 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 +
|
(trailheads input)
|
||||||
(map (partial walk test-map) (trailheads test-map)))
|
|
||||||
|
(mapcat (partial step input) (trailheads input))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user