mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:23:17 -09:00
format/clean
This commit is contained in:
parent
e61dd6837d
commit
f60fc29a23
@ -25,8 +25,7 @@
|
|||||||
(let [new-locs (->> (steps loc)
|
(let [new-locs (->> (steps loc)
|
||||||
(filter #(= (input %) c))
|
(filter #(= (input %) c))
|
||||||
(filter #(not (seen %))))]
|
(filter #(not (seen %))))]
|
||||||
(recur
|
(recur (into acc new-locs)
|
||||||
(into acc new-locs)
|
|
||||||
(conj seen loc)
|
(conj seen loc)
|
||||||
(into locs new-locs)))))))
|
(into locs new-locs)))))))
|
||||||
|
|
||||||
@ -40,15 +39,12 @@
|
|||||||
(defn get-ans [f]
|
(defn get-ans [f]
|
||||||
(loop [acc 0
|
(loop [acc 0
|
||||||
[loc & to-see]
|
[loc & to-see]
|
||||||
(set (keys input))
|
(set (keys input))]
|
||||||
; #{[0 0]}
|
|
||||||
]
|
|
||||||
(if (nil? loc)
|
(if (nil? loc)
|
||||||
acc
|
acc
|
||||||
(let [shape (get-shape loc)
|
(let [shape (get-shape loc)
|
||||||
value (f shape)]
|
value (f shape)]
|
||||||
(recur (+ acc (* (count shape)
|
(recur (+ acc (* (count shape) value))
|
||||||
value))
|
|
||||||
(s/difference (set to-see) (set shape)))))))
|
(s/difference (set to-see) (set shape)))))))
|
||||||
|
|
||||||
;; part 1
|
;; part 1
|
||||||
@ -78,12 +74,6 @@
|
|||||||
[false false false]}) ;;outer
|
[false false false]}) ;;outer
|
||||||
count))
|
count))
|
||||||
|
|
||||||
(defn inner-corner? [pos shape]
|
|
||||||
(seq (->> pos
|
|
||||||
corner-triples
|
|
||||||
(c/mmap #(contains? shape %))
|
|
||||||
)))
|
|
||||||
|
|
||||||
(defn get-num-corners [shape]
|
(defn get-num-corners [shape]
|
||||||
(reduce + (map #(corner-count % shape)
|
(reduce + (map #(corner-count % shape)
|
||||||
shape)))
|
shape)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user