mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 05:23:17 -09:00
format/clean
This commit is contained in:
parent
e61dd6837d
commit
f60fc29a23
@ -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)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user