From bdd2a032301e846b5bfc2ffe6a9dca0047ee7ea2 Mon Sep 17 00:00:00 2001 From: Aleh Suprunovich Date: Thu, 12 Dec 2024 21:27:08 +0300 Subject: [PATCH] fixup! day 10 WIP --- src/day10.clj | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/day10.clj b/src/day10.clj index 35dd8c1..016dd82 100644 --- a/src/day10.clj +++ b/src/day10.clj @@ -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))