ps: it is called re-cursion because I want to repeatingly curse it. this might be the day I call it quits on the 2nd star. I just produced my first stackoverflow of this year’s aoc and I am tired, late and the Glühwein from hours earlier is not helping
I don’t like recursion. I mean it’s useful and sometimes it’s absolutely the best way to do a thing. But it’s always a pain to debug, perhaps particularly because I like print-debugs much more than instrumenting the whole thing and putting it under gdb or whatever, and I find I’m much more prone to use stacks and queues. (I think I’m giving nothing away to say I used one of those today.)
AoC day 16
Heh heh heh. Part 1 reminded me of the lava crucibles one from 2023 day 17, and I solved it in a similar way by making direction a component of node identity and throwing it at Dijkstra. For part 2, Dijkstra doesn’t have an all-best-paths output, but A* does.
My brain is fuzzy since yesterday. I can’t think straight. I gave up oin part 2 more or less last night for Day 15 and Day 16 I can do the first part but only with the test inputs… for prod I am getting cycles I guess and I am so sure I did the hashCode/equals thing right.
Also, can’t concentrate on my work. I think I need a break. I feel overwhelmed with things.
I think I didn’t get enough sleep this week-end due to reasons that were not all AoC induced.
Sympathies! I’ve had AoC days like that.
And sonetimes my enthusiasm just evaporates.
I managed to wake up later in the day.
My Day 16 Dijkstra had “distance” included in the equals/hashCode. Classic and very stupid mistake.Very frustrating when my whole dijkstra thing is well tested and works for best paths! But of course I need to implement a unique “Pathable” for each version and I keep forgetting the little things.
Weirdly, I made a variant for part 2 that works for my input but not for the two test cases and I am not sure why it works at all. Maybe a happy accident?
I am not sure I am going back to yesterday’s part two. In theory I know how it works and what I need to do in practice I am too busy/tired to do it. Maybe another day.
AoC Day 16
Spoilers
Unfortunately, it was Day 17 I washed out in 2023. Though my struggles here are dissimilar. But maybe that’s the problem.
Still working on part 2
It is a bit difficult to keep searching when the best path is the goal… and all variants?
I had an idea when finding path pieces that converged on the same nodes that I would store those additional pieces with the path I was keeping instead of throwing them out but my own design prevented that
So my Dijkstra implementation seemed to work quite well for part 1. Part 2 I had to make some modifications like storing paths in a list and continuing to search. I am not sure if that isn‘t already enough. I also eliminated a check that would replace paths on the queue if the new one with the same node was cheaper. I would now just add the new one and keep the old. And then I sorted all the paths by distance and eliminated the ones that weren‘t in fact „best“ (except my prod input didn‘t have any of those ones)
But today I am operating in brainfog mode so all of this may be quite wrong despite me getting the star. See line 89 and following.
My approach was to flood-fill from the end. But somehow, it’s working but not 100%. Enough to complete part 1 successfully, but not enough to optimize my approach for part 2.
I might just have to start over with a different approach.
Actually…this is about coding stuff for work.
But since my python skills are sorely underqualified for producing high quality code and it turns out even internal tools should be robust…
“Hey chatGPT can you please check my code for possible issues with error handling”
So helpful. Of course I need to still understand it all… but it is a huge help because I lack a lot of basics in python but I can transfer my understanding of java with a little AI support.
AoC 16 part 2 hint
Dijkstra stops at the first optimal path it finds.
A* can be told to list all optimal paths (though there can be quite a lot),
Finished Everybody Codes last night after a not of sweating over what turned out to be a false optinisation. When you’re looking for a minimum cost path through multiple nodes with complicated extra data, in this case a height value depending on the path, you cannot necessarily just concatenate the minimum cost from 0 to 1, minimum from 1 to 2, etc.; sometimes you need a non-optimal 0 to 1 because that lets you save more on 1 to 2.
AoC day 17
Hee hee I enjoyed Intcode in 2019 (possibly in part because it was the first AoC I completed).
Part 2 required me to look at the actual code, from which I determined that the last value is a function only of the top 3 bits, the next value back of the top 6, etc., so progressive search.
AoC 16 Part 2
hidden
I’ve left my first two approaches running over night; the first very naive with few optimizations, and the second one with a full-fledged node/edge pathfinding (A*-ish?)
Both of those are taking… forever.
So while waiting, I refactored it to use the python library networkx
. Which crashes; presumably from heap allocation failure.
This is all running in WSL[1] on my desktop computer…
AoC 17
Looks like fun. 2019 was also one of my favorites and I’m looking forward to it… as soon as Day 16 is double-starred.
Windows Subsystem for Linux ↩︎
For Day 17.1 I struggled a lot and completely unnecessarily because I failed to realize where I had to put the “program end” in my nicely oo-ified problem solution. Meh.
For Day 17.2 I just realized that I have to deal with numbers that are very very big. in every runthrough my program a is divided by 8 and I need 16 outputs before the program can end. This means I need Math.pow(8,18)=2.81474976710656E14 as a starting point. This will not do.
I think I need to think more.
At least you’re not using JavaScript which has things that act like ints until you get up to 32 bit and then they silently lose precision. Modern JS has BigInts which are great, but you need to thunk them back into standard JS scalars to do things beyond maths with them.
I am not sure BigInt is the answer here. At least not until i have understood my “program” well enough to throw out a huge bunch of iterations
AoC Day 16 part 2
I solved the problem! All I had to do was stop being dumb
In reality, I simply had to break out my logic and find the shortest path first so that I could use that to keep my full path detection in-check and cull spurious leafs.
On to Day 17!
Joined in with Advent of Code quite late (busy at work but now free enough that I can do a bit while waiting for things to run)
I’ve gotten to day 6 (where you have a guard walking in straight lines and bumping into things) and part 2 might be enough for me… I’ve got something working on the example input but once I go to the full input there is definitely something I’m not accounting for or messing up more complex situations. Not entirely sure how to debug it yet since there’s not obvious ways to manually find errors or check what I’d expect. But might come back to it and see if I can untangle things.
Welcome to tekeli.li AoC Club!
day 6 part 2 hint
Are you moving into the obstacle before you turn?
What language?
I am kind of proud of myself for finally actually solving another part 2 (and not just staring at goats until Christmas trees appeared) ! It took me way more time than it should have which shows how crazy some of the people doing this are. But after being stuck a little bit and then a little less … finally I fiddled more with the debugger and then figured out how to do the calculation almost manually and there I thought “wait wait… you dont have to do that you can automate it… wait that means you can actually PROGRAM it!”
Sorry I am excited.
Day 17 not necessarily fun but satisfying. (Oh yes and fun, too. Spatial puzzles were enough already)
My thinking tends to go backwards a lot. So that helped.
I also compared my program with that of a friend and the only difference in our programs were a couple of xors and the order of some instructions. Didn’t help much by the time I saw that I was already past analyzing the program. XOR is not the kind of math my head does easily (or at all)