adventofcode

Happy Advent 2020! Please put answers in the pinned threads or create one if it does not exist yet. | https://github.com/adventofcode-clojurians/adventofcode-clojurians | Join the private leaderboard with code 217019-4a55b8eb
Average-user 2018-12-19T02:55:54.775600Z

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

mfikes 2018-12-19T12:05:12.791500Z

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

Average-user 2018-12-19T02:57:09.776200Z

Works fine with sample input though

misha 2018-12-19T03:40:02.777Z

2015 macbook pro, 2.2 i7

misha 2018-12-19T03:42:05.777200Z

oh, I see you probably meant 18:

Loading src/adventofcode/2018/day18.clj... 
"Elapsed time: 197.051339 msecs"
"Elapsed time: 6098.122681 msecs"
Loaded

2018-12-19T06:02:47.778700Z

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

quoll 2018-12-19T06:09:08.778800Z

The problem with falling behind (Xmas parties are a thing at this time of year) is that I think I’m doing something clever only to discover that someone else did it a few days before I did

quoll 2018-12-19T06:10:26.779Z

I nearly used a fixpoint, but decided it was easier to see when I’d cleared all of the ambiguities

quoll 2018-12-19T06:14:37.779300Z

well… sort of the same. I kept reversing my map, because each time I did, new singletons emerged. Bijective mappings are like that 😄

2018-12-19T06:19:03.779700Z

Oh sweet release, done with day 15.

2018-12-19T06:35:34.781100Z

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

fellshard 2018-12-19T08:12:13.789Z

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

fellshard 2018-12-19T08:12:47.789200Z

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

2018-12-19T08:39:11.789400Z

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

fellshard 2018-12-19T08:54:00.789800Z

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.

2018-12-19T06:38:17.783500Z

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.

2018-12-19T06:43:03.785500Z

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.

markw 2018-12-19T07:42:23.786500Z

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

2018-12-19T09:38:44.790Z

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

markw 2018-12-19T07:43:04.787200Z

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

misha 2018-12-19T07:44:10.787900Z

@norman "1h in" is late? :d:

2018-12-19T08:40:00.789600Z

Yes.

misha 2018-12-19T07:59:14.788400Z

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"

fellshard 2018-12-19T08:12:13.789Z

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

fellshard 2018-12-19T08:12:47.789200Z

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

2018-12-19T08:39:11.789400Z

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

2018-12-19T08:40:00.789600Z

Yes.

fellshard 2018-12-19T08:54:00.789800Z

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.

2018-12-19T09:38:44.790Z

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

ihabunek 2018-12-19T10:52:22.790500Z

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

mfikes 2018-12-19T12:05:12.791500Z

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

ihabunek 2018-12-19T13:22:44.792200Z

i annotated the assembler code (major spoilers) https://gist.github.com/ihabunek/3ce189a597e207ee9f35ad2d5e82bcb6

baritonehands 2018-12-19T13:41:52.793300Z

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

baritonehands 2018-12-19T13:42:02.793600Z

Still haven't figured out part 2

baritonehands 2018-12-19T13:42:30.794Z

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

taylor 2018-12-19T14:30:43.794600Z

yep, very similar to day 23 last year https://github.com/taylorwood/advent-of-code/blob/master/src/advent_of_code/2017/23.clj

ihabunek 2018-12-19T14:33:24.794900Z

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

uneman 2018-12-19T15:03:33.796400Z

https://github.com/namenu/advent-of-code-2018/blob/master/src/year2018/day19.clj I had a tough time disassembling the code...

benoit 2018-12-19T15:26:15.797300Z

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🙂
ihabunek 2018-12-19T15:28:11.797700Z

this year seems harder than previous

taylor 2018-12-19T15:31:38.798300Z

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

2018-12-19T17:56:58.798500Z

https://www.twitch.tv/timpote

markw 2018-12-19T18:04:53.799100Z

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

2018-12-19T18:37:19.804900Z

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

2018-12-19T18:38:20.805Z

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

ccann 2018-12-19T19:16:38.805200Z

same

fellshard 2018-12-19T19:59:18.805400Z

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

fellshard 2018-12-19T20:00:14.805700Z

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

pesterhazy 2018-12-19T23:10:50.806200Z

Yeah pretty much stuck on day 19

pesterhazy 2018-12-20T08:17:01.811300Z

Ok will try that again

pesterhazy 2018-12-20T08:17:46.812700Z

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