projects
/
adventofcode2019.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add broken day16pt2
[adventofcode2019.git]
/
src
/
adventofcode2019
/
day16.clj
diff --git
a/src/adventofcode2019/day16.clj
b/src/adventofcode2019/day16.clj
index 04d6714636da5e79938305e86fead68c91998a86..0e4bc6e1510edb6a20da852e744ce3ba103f2c9a 100644
(file)
--- a/
src/adventofcode2019/day16.clj
+++ b/
src/adventofcode2019/day16.clj
@@
-20,14
+20,26
@@
(parse-int)))]
(map-indexed transform input)))
(parse-int)))]
(map-indexed transform input)))
-(defn result-of [input]
- (as-> (parse-input input) it
- (iterate phase it)
- (nth it 100)
- (take 8 it)
- (str/join it)))
+(defn result-of
+ ([input]
+ (result-of 0 input))
+ ([offset input]
+ (as-> (parse-input input) it
+ (iterate phase it)
+ (nth it 100)
+ (drop offset it)
+ (take 8 it)
+ (str/join it))))
+
+(defn fft [input]
+ (->> (repeat 10000 input)
+ (str/join)
+ (result-of (->> input
+ (take 7)
+ (str/join)
+ (parse-int)))))
(defn day16 []
(let [[input] (get-list-from-file (input-file))]
(part1 (result-of input))
(defn day16 []
(let [[input] (get-list-from-file (input-file))]
(part1 (result-of input))
-
#_(part2
)))
+
(part2 (fft input)
)))