Fork me on GitHub
#adventofcode
<
2018-12-19
>
Average-user02:12:54

@mfikes Your solution to day 17 running in jvm, throws stack overflow almost immediately

mfikes12:12:12

Right, you need to increase the stack size to 2 M

Average-user02:12:09

Works fine with sample input though

norman06:12:47

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.

norman06:12:34

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

fellshard08:12:13

You're basically supposed to break the assembly apart for this problem, I believe. There was a similar one like this last year.

fellshard08:12:47

Once you've 'decompiled' it, you can arrive at an answer in a much, much more reasonable manner.

norman08:12:11

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

fellshard08:12:00

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.

norman06:12:17

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.

misha07:12:14

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"

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.

markw07:12:23

well… there goes an hour. I misread the problem and thought that the initial register pointer was also the initial value of the pointer

meikemertsch09:12:44

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

markw07:12:04

That and forgetting to change the starting register pointer from the test input to actual input

misha07:12:10

@norman "1h in" is late? d

ihabunek10:12:22

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

ihabunek14:12:24

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

baritonehands13:12:52

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

fellshard19:12:18

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

baritonehands13:12:02

Still haven't figured out part 2

baritonehands13:12:30

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

benoit15:12:15

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 🙂

😖 1
🙂 1
fellshard20:12:14

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

ihabunek15:12:11

this year seems harder than previous

taylor15:12:38

I had to stop too, between work and family the problems were taking too long 😞

markw18:12:53

@ihabunek I feel the same... I've done all years and this is by far the most difficult

norman18:12:19

Nothing this year strikes me as particular more difficult than last year - just longer and more puzzle-ish.

norman18:12:20

But, I have NOT done all the years, so maybe there has been a trend towards more difficult problems

pesterhazy23:12:50

Yeah pretty much stuck on day 19

fellshard00:12:10

Trying to brute-force the second part?

gklijs06:12:13

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.

☝️ 1
pesterhazy08:12:01

Ok will try that again

pesterhazy08:12:46

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