Commit Graph

9 Commits

Author SHA1 Message Date
2c224483b4 Day 9 solution
As always, plenty of room for improvement, but I'm reasonably satisfied with the core implementation. I'm honestly not sure why the Distinct is needed in the GetBasinSize() result as it's supposed to not even add the point if the point is already in there, but it's late so I'll check that out later.
2021-12-09 00:40:02 -06:00
1330d1eb66 Day 8
I hate almost everything about this solution. It's all awful and a product of constantly adjusting how I was solving the problem to try and get the correct answer, so there are vestigial pieces of each road I headed down. Then I ended up using some combination of all of those pieces to get the actual answer, and...well it just needs to be overhauled dramatically. But it works, so I guess mission accomplished.
2021-12-08 10:57:36 -06:00
cfb3c668c7 Day 7 solution
I'm reasonably happy with this one. I'm sure there's an easier way to determine the smallest distance, at least for part 1, but this works fast enough for me.
2021-12-07 07:56:11 -06:00
2cc95c6e8e Day 6 solution
Took me a while to come to the fast solution, but I got there.
2021-12-05 23:55:15 -06:00
7d93691276 Day 5 solution
There is a lot to be disliked here, starting with the Line Length calculation, which I'm sure I'm just totally overthinking or otherwise being dumb about, to the way I'm picking the next point while moving along the line.

Also, TIL how much of a difference a good GetHashCode() override can make when comparing/equating custom struct instances. Not implementing GetHashCode() on this solution resulted in ~250ms runtime on my PC. Implementing a "bad" GetHashCode() (which was `return x.GetHashCode() | y.GetHashCode();` which seemed fine to me ¯\_(ツ)_/¯) resulted in >1s runtime on my PC. Using this implementation (HashCode.Combine()) results in ~25ms runtime on my PC. Those numbers are with nothing changing other than the implementation of GetHashCode() on struct Point.

I also disabled nullability in my quest to improve performance here. The compiler was complaining that my Equals() override wasn't equivalent because of nullability, so it had to be `object? obj` which I didn't care for since this was a value type and not a reference type.
2021-12-05 11:19:13 -06:00
3dc7e1ccde Day 04 in javascript
This is a lot of copy/paste, but I am on a time crunch this morning so I'll clean it up later!
2021-12-05 11:19:10 -06:00
12b004c724 Day 3 solution. Not clean, but oh well. 2021-12-03 10:00:48 -06:00
83e16885c7 Day 2 solution in C# 2021-12-02 10:03:00 -06:00
1da6d83760 Day 1 solution in Rust
I have no idea what I'm doing in Rust, and I definitely don't understand
borrowing yet, so this is a hideous solution on multiple fronts. I'm not
sure that I'll be sticking with Rust as AoC doesn't feel like a
conducive environment to learn it in.
2021-12-01 08:00:40 -06:00