diff --git a/2024/src/day12.clj b/2024/src/day12.clj index 8b771f0..8dd2168 100644 --- a/2024/src/day12.clj +++ b/2024/src/day12.clj @@ -25,10 +25,9 @@ (let [new-locs (->> (steps loc) (filter #(= (input %) c)) (filter #(not (seen %))))] - (recur - (into acc new-locs) - (conj seen loc) - (into locs new-locs))))))) + (recur (into acc new-locs) + (conj seen loc) + (into locs new-locs))))))) (defn get-perimeter-count [shape] (->> shape @@ -40,15 +39,12 @@ (defn get-ans [f] (loop [acc 0 [loc & to-see] - (set (keys input)) - ; #{[0 0]} - ] + (set (keys input))] (if (nil? loc) acc (let [shape (get-shape loc) value (f shape)] - (recur (+ acc (* (count shape) - value)) + (recur (+ acc (* (count shape) value)) (s/difference (set to-see) (set shape))))))) ;; part 1 @@ -78,12 +74,6 @@ [false false false]}) ;;outer count)) -(defn inner-corner? [pos shape] - (seq (->> pos - corner-triples - (c/mmap #(contains? shape %)) - ))) - (defn get-num-corners [shape] (reduce + (map #(corner-count % shape) shape)))