Commit Graph

28 Commits

Author SHA1 Message Date
14c7dac953 Day 24
I...again don't fully understand what I've done here. After reading the problem and printing out the binary representation of x + y and z, I looked at the bits that weren't correct and started trying to reason about why that might be. Manually swapping around outputs started to yield some results, so I hacked around until I got something that worked and submitted that answer. Once I had it by hand, I went searching for help on Reddit for how to solve this programmatically, and found a lot of chatter about half-adders and junk, so this is implementing some posts I saw there to search for the incorrect sequences and rewire them.
2024-12-24 02:07:57 -06:00
b4294083a3 Day 23
I solved this initially in a way that took around 15 seconds to run (check every possible combination of computers to see which ones were all connected), then did some research and found the "Bron-Kerbosch algorithm" for solving this problem, and wouldn't ya know, a named algorithm solves the problem way faster than brute force. Funny that.
2024-12-23 16:39:15 -06:00
8315f73e0a Day 22 optimization
Cut out tuples to save a large amount of time

This is also more correct/accurate in that it stores the total for all sequences across all buyers rather than requiring the best sequence to be in the first buyer's set.

Finally, it turns out that the float divide/truncate was unnecessary and also costing some time.

In the debugger, part 2 now finishes in around 675ms. Debug config outside the debugger is done in 360ms, and Release in 200ms. Good enough for now, I think.
2024-12-22 10:12:53 -06:00
5dca2c96f9 Day 22
Fun with properly executing instructions.
2024-12-22 00:06:53 -06:00
296ac5a406 Day 21
This one was a real doozy. I was all kinds of twisted up trying to find a valid solution here and built + threw away at least 3 implementations that each _almost_ worked.
2024-12-21 16:28:52 -06:00
73a1b0567a Day 20
This is slower than I'd like but I'm kinda tired of grids, so...probably not going to revisit it to improve.
2024-12-20 17:37:58 -06:00
4effa6940d Day 19
Nothing a little caching can't solve!
2024-12-19 09:06:48 -06:00
9e0c8028e0 Day 18
This is slow and I'm not sure why. I should probably have used my Dijkstra utility, but I'm not convinced it's working right now.
2024-12-18 09:33:14 -06:00
12b9f7fdf5 Day 17
Part 2 was a doozy. I sought some help online for understanding what the program was doing and how to feed it an input to get the output we were after.
2024-12-17 10:13:16 -06:00
3c4ce451b9 Day 16
Everything about this is awful, but it was my first idea for implementation and it got the right answer...eventually...so whatever. I'll probably fix it later. Maybe.
2024-12-16 15:36:36 -06:00
490af7d23b Day 15
I'm sure there's a more elegant way to handle part 2 than my hackneyed "now check against two points instead of one", but this works and comes in a hair under 500ms on my machine, so...I'm not too broken up about it.
2024-12-15 14:59:34 -06:00
2b091368fe Day 14
I had no idea what to look for, so I wrote a rudimentary (slow) detector and it worked out.

See comment in part 2 for explanations of why this only works with my input...
2024-12-14 11:09:21 -06:00
b701d86c61 Day 13
There's no way I was going to end up solving this myself, so I found "Cramer's Rule" that solves a system of equations.
2024-12-13 11:14:43 -06:00
7b968463d6 Day 12
This one is sloppier than I'd like, but these visual problems always throw me for a loop anyway. I was lucky I was able to use the ugly "num corners" trick quickly here.
2024-12-12 15:42:03 -06:00
5af2ab5c39 Tiny cleanups 2024-12-11 08:40:14 -06:00
d303317ad8 Day 11
I'm reasonably satisfied with this. I saw the part 2 change coming, but still failed to prepare adequately, so my delta was higher than I wanted.
2024-12-11 08:38:30 -06:00
ca86573f8f Day 10
🎵 All I need for Advent is my ivec2, my ivec2, my ivec2...
2024-12-11 08:38:30 -06:00
409bdf2fd9 Day 9
Part 1 is pretty ugly, but fast. Part 2 is slower than I'd like (~200ms in Release) so I may revisit, but it's fast enough for now. The slowest part seems to be FindIndex on the gap list.
2024-12-11 08:38:30 -06:00
61ba061c6b Day 8
Took me a little while to understand the problem, but once I did, ivec2 came in clutch once again.

Would have had part 2 sooner if not for the "also all antennas are now antinodes" thing which I just missed. You win again, reading comprehension.
2024-12-08 12:47:53 -06:00
57ed9d261e Day 7 optimization
Okay, this optimization was easier than I thought it'd be.

I started by not building a new list every time I wanted to operate on the next value since that seemed like low-hanging fruit. That helped, but not as much as I expected (as is always the case with optimization, I feel).

Next I ran this under a profiler and it showed that string concatenation was the biggest offender, so I found a way to do that without involving strings (it's a bit convoluted, but optimizations tend to do that...) and that cleaned up most of the problem.

After that, getting the next element from the list was a (very minor) next-highest offender, so I cached that locally.

Finally, on a whim I decided that the tuple wasn't helping me anymore, so I removed it and was surprised to see another 100ms or so disappear. I guess constructing those is worse than I thought...gotta file that away for later. I'm a little surprised that it didn't show up in the profiler (or I didn't know how to read it, perhaps).
2024-12-07 10:50:59 -06:00
df526c6e3f Day 7
This solution is bad and slow and there are probably ways to make it not as bad and not as slow, but I'll take < 1 second runtime for now.
2024-12-07 10:19:02 -06:00
7c49d88869 Day 6
Part 2 gave me more trouble than it should have, mostly because I was initially turning and stepping at the same time which ended up being a big mistake.

This runs in a few seconds in Debug, but only a half a second in Release. I feel like it can be much faster, but I don't have any ideas on doing that just yet.
2024-12-06 08:34:42 -06:00
ed5ca6d763 Day 5
It took me a minute to figure out a good solution for part 2, but I'm pretty happy with the custom-sort-function implementation.

I also really like the LINQ one-liners for getting the actual totals. I feel like future-me is going to be mad and confused, but right now it feels fun!
2024-12-05 00:35:58 -06:00
66f0f805a8 Day 4
This solution feels pretty bad. I think I shouldn't have used my ivec2 utilities and just checked the next spots for part 2. It would probably have been simpler given all the constraints. I'm also certain there's a smarter way to solve this than what I did, but...it works, so...?
2024-12-04 08:45:21 -06:00
dbee23c6a3 Day 3
With thanks to my best friend Regex
2024-12-03 07:59:16 -06:00
e6c4473934 Day 2
This is ugly, but the problem is small enough that it works just fine.
2024-12-02 08:20:03 -06:00
0359b86174 Add automatic input downloading
Since we no longer include input files with the solution, per AoC guidelines, this will enable other users to use this application (after specifying their session token) without manually grabbing all the appropriate download files.
2024-12-01 11:13:56 -06:00
8120a52ba0 Day 1 2024-11-30 23:17:46 -06:00