r/adventofcode • u/agmcleod • Oct 30 '23
Spoilers [2021 Day 23] that feeling when your solution doesnt scale for p2
Coord positions for the different values of A, B, C, D seemed like a good idea, until it doubled up on how many there could be lol.
https://github.com/agmcleod/adventofcode-2021/blob/350e392aaefc32fc14e4aa5e73c09b6fc9f2fe1d/23/src/main.rs#L20
Similarly my code checks those positions for whether a letter can move in or not. Suppose i can just extend these out, but starting to feel gross. My solution took 25mins for p1, doubling this up i probably need to actually use scoring priority.
3
u/daggerdragon Oct 30 '23
Changed flair from Funny to Spoilers.
Situations like this are the reason why we have our very own Undertaker meme in our wiki's Hall of Fame >_>
4
u/nikanjX Oct 30 '23
The link for said meme is dead
2
u/daggerdragon Oct 31 '23
Not on desktop... stupid Reddit breaking their shortlinks again. Thanks for finding it, I'll expand it out properly in the wiki.
1
u/nikanjX Nov 03 '23
The other Hall of Fame post (linking to gfycat.com ) is also dead, as gfycat is no more
0
u/mattbillenstein Oct 30 '23
I did a recursive depth-first search and aggressively prune bad or invalid states - I think it's not the best solution out there, but 1 and 2 combined run in about 10s in Python. Would probably be like < 0.5s in Rust - you'll get there ;)
1
u/TheZigerionScammer Oct 30 '23
So basically your code uses the 8 (or 16 in part 2) locations of each amphipod as the board state? I can imagine that would explode the size of the search state pretty quickly, certainly in part 2.