@potetm — Have the old videos scrolled off of Twitch? — I’m still back on day 4
@tbrooke They have. I have the recordings I’m planning on posting on my site soon.
My code is posted at https://github.com/potetm/advent-of-code
How I spent the last hour of my life:
target: 14,796
Oh, my region is 14796 x 14796…. That’s kind of big ….
sigh
14x796 is much more manageable
I'm gonna have to finish part two tomorrow; I don't think I can rely on creating a static graph with JGraphT, I need to be able to expand it on the fly. 😞
Things I re-learned today: it’s really hard to memoize a recursive anonymous function….
Is day22 pt2... A* again?! 😨
seems so, but the map changes based on tool used
wasted hours, and solution passing tests returns wrong result after 20 minutes :dafuq:
reddit says dijkstra
@potetm - I’m still working on comparing my failed attempt at 4 with your solution - in looking back through the thread here I noticed you highlighted a discussion in #10 so I plan to jump around and go to #10— keep highlighting good ones or ones that follow others — I am at the level where I can get started but usually end up stuck with most of the problems and I need the video to get through
djikstra (weighted BFS) works but is kind of slow. You may need to cheat the dimensions or use A*,
I my new holiday spirit of of writing garbage code for AoC I did the the former, but I may switch over after I clean up and commit because it’s an interesting search problem
I do like the twist of the tools here. I kind of makes a 2d grid into a 3d grid
and representing it as a 3d grid actually makes the solution pretty straight forward.
https://github.com/IamDrowsy/advent-of-cljc/blob/master/src/aoc/y2018/d22/iamdrowsy.cljc
there's probably alot of potential to optimize, but it runs in about 2,5 secs for part 2
You beat me: “Elapsed time: 5045.311258 msecs”
And it looks like your effective X search is larger than mine too… It looks like the main difference is I visit one node at a time and you visit all the nodes for time T at the same time, which seems to provide some efficiencies
right I'm just storing which nodes are reachable after n seconds, advancing the seconds until the target is in this set.
I'm not sure whether I have an off by one error, or my solution is 'better' than the approved one. The example runs correct, but on my data the output is 1088, while the accepted answer was 1089.
Maybe you are really good at changing tools 🙂
Are you allowing your search to go beyond the target [x y]?
it would return longer path then, not shorter. I also got shorter results
Probably a bug then. When I filter the routes more aggressively I do get the answer, and it's a solution that takes less steps.
@drowsy used your approach of sets 1 distance at a time, after I wasted half a day waiting "per-xy" to complete, with all the different filters and sorting and stacks/lists/queues combinations.
and it doe not accept an answer :kappa:
it is off by 4! can't even blame off-by-1™
From a Kotlin slack channel came the awnser, apparently when you change the tool, it has to be valid in the current one. So for example you can't put away the torch in a rocky place to move into a wet place. Or put your rock climbing gear in a narrow area to move to a rocky one.
hm, looking into it
yep, that did it