Fork me on GitHub

@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


Got started late on day 19. First part was trivial. Part 2… Wait? Try and optimize code? Look for a trick? Hmmm

Ben Grabow06:12:03

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.


(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"

Ben Grabow06:12:03

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


today's task was very similar to last year's assembler thingy


yeah, i solved that one, that's why today's was pretty easy for me 🙂


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)]


Same, was delighted that the code was so easily reusable.


Still haven't figured out part 2


I was able to speed it up 10K times, but it still didn't finish overnight


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 🙂

😖 4
🙂 4

The time crunch starts getting harder as it goes on. Glad you could join as far as you could!


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


Yeah pretty much stuck on day 19


Trying to brute-force the second part?


If you print each step you can see a certain pattern. It could take very long for part 2 to complete if you don't change the program.

☝️ 4

Ok will try that again


I tried disassembly on paper but that wasn’t easy at all