about summary refs log tree commit diff
path: root/day03.clj
blob: 16981d1f49fab05db4732d91fdc6dd7868b3f63d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(def data
  (->> (slurp "day03")
       (clojure.string/split-lines))

(defn slop [step]
  (->> (range)
       (map #(mapv (partial * %) step))
       (take-while #(< (first %) (count data)))
       (map (fn [[x y]]
              (nth (cycle (nth data x)) y)))
       (filter #{\#})
       (count)))

(slop [1 3]) ; => 270
(apply * (map slop [[1 1] [1 3] [1 5] [1 7] [2 1]])) ; => 2122848000