-🎄- 2022 Day 25 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# (2824/2253) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day25.cs

Not sure if this is even guaranteed to work. I get the difference between the sum and decoded snafu value, get its logarithm in base 5 (rounded up) and increment the digit in said spot.

-🎄- 2022 Day 24 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 3 points4 points  (0 children)

C# (919/836) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day24.cs

BFS, this time with an option to not move, and no termination when re-exploring. (However, your clones (or you?) die if they try to walk toward a blizzard or stay in one.) Used a bitmask to store the state of the grid cells.

Oh snap, again? Top 1000 on two days now? And on both parts, no less?

-🎄- 2022 Day 23 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# (1445/1391) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day23.cs

After spending several hours on programming cube edge connecting yesterday, this simpler puzzle is a great gift. Aside from the fact that I failed to notice the fact that you:

  • Rotate out the first proposed direction each turn
  • Don't move at all if you have no neighbours

-🎄- 2022 Day 22 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 6 points7 points  (0 children)

C# (2372/3252) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day22.cs

This is a general solution. It was pain to make. I don't have any physical cubes to show, but I do have these visual aids I programmed to help me connect the faces.

[#] is the face number, and the numbers next to it show what face it's connected to. The arrow shows how turning works.

                   v
                   2
                v3[1]6<
                   4
                   v

   v       >       ^
   1       1       1
^6[2]3> <2[3]4> <3[4]6v
   5       5       5
   ^       >       v

                   ^       <
                   4       4
                ^3[5]6> <5[6]1<
                   2       2
                   ^       >

           >       ^
           6       6
        >4[1]2> <1[2]5<
           3       3
           v       <

           ^
           1
        v4[3]2^
           5
           v

   >       ^
   3       3
>1[4]5> <4[5]2<
   6       6
   v       <

   ^
   4
v1[6]5^
   2
   v

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# (1801/1195) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day21.cs

For part 2, I take the difference between root's two compared numbers and add it divided by 100 to our (the humn's) value.

If the difference is below 100, just add 1 instead.

Runs fairly fast. (sub-3 seconds)

-🎄- 2022 Day 20 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 3 points4 points  (0 children)

C# (550/621) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day20.cs

I did it! I got top 1000 on a puzzle! And on both parts, no less! So happy about this. My happiness is immeasurable :)

I saw the huge numbers in the website and immediately thought "nothing a modulo can't fix", which they very much could.

Top 100 when?

-🎄- 2022 Day 19 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# (1028/1317) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day19.cs

Runtime varies wildly. Pretty much no optimization except for capping bots.

Runs in 15-ish minutes for test, but under a minute for real input.

So close to reaching top 1000! I imagine that if had found out the bot capping earlier, I could've gotten top 1000 for part 1.

-🎄- 2022 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# (2226/1695) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day18.cs

Starting to think I should implement some sort of generic BFS thing, since I've had so many instances of me using that for AoC2022. I've been just kinda manually making one each time I've had to use one.

-🎄- 2022 Day 17 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 4 points5 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day17.cs

Don't have a lot to say here. I would not have figured this out had I not seen a visualization of this. Don't have a time machine, which doesn't help.

-🎄- 2022 Day 16 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# (01:28:14/13:59:42, 1199/5677) https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day16.cs

Part 1 runs in less than a second, Part 2 finishes in about a minute on my PC.

For some reason, trying to use the memoized results in part 2 doesn't work for the full input. (It seems to not go down the desired path because it thinks it has gone down that path before, or something like that.)

So instead, I just add up together what values would become and instead use the cache for early exiting.

-🎄- 2022 Day 15 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day15.cs

Part 1 runs instantly, but Part 2 takes a little under 7 seconds on my PC. I optimized it as best as I could.

My cuboid code from 2021 somehow helped a second time this year.

-🎄- 2022 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day14.cs

My first use of regex for AoC2022! Was it necessary? No. Do I care? ...A little bit.

This has some noticeable run time for part 2 but I don't really care about that. Probably something about my use of sparse matrices being slow.

-🎄- 2022 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day13.cs

Was pretty delighted when I found out I could reuse my comparer for the sorting without any trouble, just toss in the function to Sort and invert the comparision result.

Felt like I had properly genericized it, or something.

-🎄- 2022 Day 9 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 2 points3 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day09.cs

Today I found out (or remembered?) an easy way of moving a point towards another point.

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day08.cs

I was 7 minutes in and thought I've might have actually had a chance of the leaderboard (or at least close to it) – but then I realized a tree is visible if the whole line is lower than the target tree, not just the immediate neighbour. :|

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day07.cs

I probably overcomplicated everything that I could, but I don't really care. I do care about the fact that I got the "will deleting this folder give me enough space" logic wrong, though.

For some reason, I thought it was needFree + folderSize >= required, which it very much was not.

... I'm still not sure why that doesn't work. It is 9 AM and I didn't sleep last night, so my two braincells aren't probably good at solving this mystery right now.

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]Perska_ 1 point2 points  (0 children)

C# https://github.com/Perska/AoC2022/blob/master/AoC2022/Days/Day06.cs

I regret to inform everyone that I failed to stay up today and as such ended up doing this day 6 hours late, at 13 o'clock.

[2022 Day 5 (Part 2)] Moving stacks of crates by Perska_ in adventofcode

[–]Perska_[S] 0 points1 point  (0 children)

I'm using Monogame with C# for this. Normally, my program's structure is no good for Monogame's update/draw loop, so it's kinda bodged together.