@mfikes Your solution to day 17 running in jvm, throws stack overflow almost immediately
Right, you need to increase the stack size to 2 M
Works fine with sample input though
https://clojurians.slack.com/archives/C0GLTDB2T/p1545057939705200
https://github.com/akovantsev/adventofcode/blob/master/src/adventofcode/2018/day17.clj
2015 macbook pro, 2.2 i7
oh, I see you probably meant 18:
Loading src/adventofcode/2018/day18.clj...
"Elapsed time: 197.051339 msecs"
"Elapsed time: 6098.122681 msecs"
Loaded
Got started late on day 19. First part was trivial. Part 2… Wait? Try and optimize code? Look for a trick? Hmmm
Oh sweet release, done with day 15.
So, I had #19 spoiled. So dumb. Basically, everyone cheated, which is to say, everyone looked at their input, figured out what their input was doing, and solved that problem
You're basically supposed to break the assembly apart for this problem, I believe. There was a similar one like this last year.
Once you've 'decompiled' it, you can arrive at an answer in a much, much more reasonable manner.
I didn’t get that far last year, but I’ve been warned about that one. I would feel better if the problem statement was “figure out what your code is doing and write that code” even if the amount of “work” is the same
You'll notice a similar pattern with several problems this year, at least: start small in part 1, then scale unreasonably high in part 2, forcing you to rethink / optimize.
Maybe I should reconcile myself to this not being a programming challenge, but being a puzzle challenge in which you’ll write code to solve the problems. But that’s not really what I signed up for. At least day 15 was, in the end, still a programming problem.
https://github.com/bgrabow/advent-of-cljc/blob/master/src/aoc/y2018/d15/bgrabow.cljc
https://github.com/bgrabow/advent-of-cljc/blob/master/src/aoc/y2018/d15/bgrabow.cljc#L210
just (map-indexed vector)
I'm pretty proud of the way I did the pathfinding. Totally functional approach, and the pathfinding function itself is lazy, letting its caller decide when to stop searching farther. I am starting to really appreciate iterate
with the termination condition farther up the call stack, instead of loop recur
for these simulation problems.
well… there goes an hour. I misread the problem and thought that the initial register pointer was also the initial value of the pointer
initial register pointer is the first row? what do you call the initial value of the pointer? I’m not sure if I might make the same error
That and forgetting to change the starting register pointer from the test input to actual input
@norman "1h in" is late
? :d:
Yes.
you could just not=
it here:
https://github.com/bgrabow/advent-of-cljc/blob/master/src/aoc/y2018/d15/bgrabow.cljc#L115-L121
https://github.com/bgrabow/advent-of-cljc/blob/master/src/aoc/y2018/d15/bgrabow.cljc#L190-L196
(let [players (concat (repeat 10 :g)(repeat 10 :e))]
(time (dotimes [_ 100] (not-empty (filter #{:e} players))))
(time (dotimes [_ 100] (some #{:e} players))))
"Elapsed time: 0.537247 msecs"
"Elapsed time: 0.272839 msecs"
today's task was very similar to last year's assembler thingy
i annotated the assembler code (major spoilers) https://gist.github.com/ihabunek/3ce189a597e207ee9f35ad2d5e82bcb6
My favorite for day 19 was that I had named all the functions on day 16, so the code was just:
(defn parse-line [line]
(let [[opcode & args] (str/split line #" ")]
(into [(symbol "aoc.dec16" opcode)] (map #(Integer/parseInt %) args))))
And to call just resolve the required symbol:
(let [[sym a b c] (instructions ip)
op-state (assoc state ip-register ip)
next-state ((resolve sym) op-state a b c)]
Still haven't figured out part 2
I was able to speed it up 10K times, but it still didn't finish overnight
yep, very similar to day 23 last year https://github.com/taylorwood/advent-of-code/blob/master/src/advent_of_code/2017/23.clj
yeah, i solved that one, that's why today's was pretty easy for me 🙂 https://github.com/ihabunek/aoc2017/blob/master/resources/day23-annotated.in
https://github.com/namenu/advent-of-code-2018/blob/master/src/year2018/day19.clj I had a tough time disassembling the code...
Unfortunately I had to stop adventofcode 😞 It was taking too much of my time as the problems got more complex. I would like to say I will do them later but I doubt I will 🙂
this year seems harder than previous
I had to stop too, between work and family the problems were taking too long 😞
@ihabunek I feel the same... I've done all years and this is by far the most difficult
Nothing this year strikes me as particular more difficult than last year - just longer and more puzzle-ish.
But, I have NOT done all the years, so maybe there has been a trend towards more difficult problems
same
Same, was delighted that the code was so easily reusable.
The time crunch starts getting harder as it goes on. Glad you could join as far as you could!
Yeah pretty much stuck on day 19
Ok will try that again
I tried disassembly on paper but that wasn’t easy at all