--- /dev/null
+(ns adventofcode2019.day13
+ [:require [adventofcode2019.lib :refer :all]
+ [adventofcode2019.intcode :as i]
+ [clojure.string :as str]
+ [clojure.core.match :refer [match]]
+ [clojure.math.combinatorics :as combo]])
+
+(defn day13 []
+ (let [input (i/get-program (input-file))
+ output (:output (i/intcode (i/build-state input)))
+ draw-tiles (fn [screen [x y t]] (assoc screen [x y] t))
+ screen (reduce draw-tiles {} (partition 3 output))]
+ (part1 (count (filter #(= % 4) (vals screen))))
+ #_(part2)))
args (map memory [(+ 1 ctr) (+ 2 ctr) (+ 3 ctr)])]
(apply operation state args)))
+(defn get-program [input-file]
+ (map parse-int (get-list-from-file input-file) #","))
+
(defn build-state
([program]
(let [memory (into {} (map-indexed #(vector %1 %2) program))]