Created
January 15, 2020 00:43
-
-
Save dilbernd/83bb70d462656fd663a0cccf5aec9c39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def inputs [...]) | |
| (def day2_2_sought 42) | |
| (defn computer [data ip] | |
| (let [[op oa1 oa2 t] (subvec data ip) | |
| o1 (data oa1) | |
| o2 (data oa2) | |
| ofn ({1 + 2 * 99 :hlt} op)] | |
| (if (= :hlt ofn) (data 0) (recur (assoc data t (ofn o1 o2)) (+ 4 ip))))) | |
| (first (for [x (range 100) y (range 100) :when (= day2_2_sought (computer (assoc inputs 1 x 2 y) 0))] (+ (* 100 x) y))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment