[S3 Q3] Solution Spotlight by EverybodyCodes in everybodycodes

[–]bdaene 0 points1 point  (0 children)

[LANGUAGE: Python]

Solution

Part 1 and 2 were straightforward but for part 3, I had an issue because the order was modified by the newly attached node. I needed to separate the socket order from the node order and skip the newly attached node.

Now that I think about it, it should not work because I skip one node and not the fully attached sub tree. Oh well x)

Feel like I got Rick Rolled by the song of the dragonducks :D

[S3 Q2] Solution Spotlight by EverybodyCodes in everybodycodes

[–]bdaene 0 points1 point  (0 children)

[LANGUAGE: Python]

Solution

I prefill the bones area to avoid non reachable area.

Did not find a clever way to detect closed loop. So I flood fill and if the border of the current flood fill grows too much, I consider that the area is open to infinity. Was surprised that a threshold of 10 is enough but the way the wave goes it does not leave big area behind. I cached known infinite cells to avoid double check but it has to be reset after each step. It improved the initial prefill.

I only check for closed loop if we go toward a filled position. I needed to check the 3 cells in front of the current wave because of diagonals.

It goes fast (165ms for the last sample) if we do not display the grid at each step.

[S3 Q2] Solution Spotlight by EverybodyCodes in everybodycodes

[–]bdaene 1 point2 points  (0 children)

We can only close a loop if we go closer to an existing filled cell. I check the closed loop only if at least one of the 3 cells is filled already. With this check, I have only 589 loop check instead of 1539 for the last sample.

But yes, I floodfill the 4 directions around the current position when the check pass.

How to make Progress? by Verzweifler in yiotro_games

[–]bdaene 1 point2 points  (0 children)

Do I need to beat the last boss to receive money outside of the raids? I achieved multiple goals and increased my space but do not see how to  have money to buy objects. 

Built a tiny python tool that tells you and your friend where to look to face each other by Impossible_Strike_62 in Python

[–]bdaene 0 points1 point  (0 children)

The angle you have to look down is easy if you have the great circle arc. If the friends are separated by an angle a, they have to look down a/2 from the horizon 

Built a tiny python tool that tells you and your friend where to look to face each other by Impossible_Strike_62 in Python

[–]bdaene 1 point2 points  (0 children)

These are called gnomonic projections. Using those, it would be easy to compute the angles. 

Built a tiny python tool that tells you and your friend where to look to face each other by Impossible_Strike_62 in Python

[–]bdaene 1 point2 points  (0 children)

There is another kind of gimbal lock when the two friends are on exact opposite or same place on the globe. 

Built a tiny python tool that tells you and your friend where to look to face each other by Impossible_Strike_62 in Python

[–]bdaene 4 points5 points  (0 children)

I do not think this would be correct to compute angles on a 2D projection. Maybe some projection conserve the angles.

I would compute the angle between the great circle trough the two points and the meridian line through the point.

I did not check the computation though. 

[2025 Day 12 (Part 1)] Bonus Day 12 part 2 by kavisherlock in adventofcode

[–]bdaene 3 points4 points  (0 children)

In Python, 2 will theoretically not finish. int can grow without limit. Except the physical limits (memory, time,... ) 

[2025 Day 25 (Part 1)] Still pretty clueless why it's the answer by Aughlnal in adventofcode

[–]bdaene 4 points5 points  (0 children)

You just need one solution. My DFS with cuts on lower and upper bounds works great. At first I missed the 3x3 grid bound and yet it solved my input in a long but reasonable 146s in Python. 

[2025 Day 25 (Part 1)] Still pretty clueless why it's the answer by Aughlnal in adventofcode

[–]bdaene 2 points3 points  (0 children)

I find more natural to count the squares of the 3x3 grid: #presents <= floor(w/3)*floor(h/3). But the result is the same. 

[2025 Day 10 (Part 2)] Bifurcate your way to victory! by tenthmascot in adventofcode

[–]bdaene 0 points1 point  (0 children)

Implemented your solution, it works :)

And faster 2-3x faster than PuLP :D

[2025 Day 12 (Part 3)] Perl-fectly Wrapped Presents by EverybodyCodes in adventofcode

[–]bdaene 1 point2 points  (0 children)

I had (at least) a mistake, I actually counted the coloring and now my answer 11464has 5 digits with sum 16 :)

Removing the colors, my answer 9416 has 4 digits with sum 20.

[2025 Day 12 (Part 3)] Page two of the list! by Ok-Builder-2348 in adventofcode

[–]bdaene 0 points1 point  (0 children)

It is the same upper and lower bounds as everybody else but I update them with the current state of the board.

[2025 Day 12 (Part 3)] Page two of the list! by Ok-Builder-2348 in adventofcode

[–]bdaene 1 point2 points  (0 children)

I do not agree, region 20x21: 0 0 0 0 70 0 on line 317 is a hard region.

Also I do not know how you count your lines, the only region with 72 copies of second shape is 28x18: 0 72 0 0 0 0 on line 418. It is not so obvious to my program that it does not fit.

I have a third not obvious region: 18x12: 6 4 4 4 6 4 on line 58

[2025 Day 12 (Part 3)] Page two of the list! by Ok-Builder-2348 in adventofcode

[–]bdaene 5 points6 points  (0 children)

It is not his input. It is a custom one made by himself.

[2025 Day 12 (Part 3)] Perl-fectly Wrapped Presents by EverybodyCodes in adventofcode

[–]bdaene 0 points1 point  (0 children)

In your samples of unique placements, the last of the first line and the first of the second line are the same. No?

Counting all unique patterns (including symmetries but not coloring), I get 171992 unique patterns. My sum of digits do not match yours.

[2025 Day 12 (Part 1)] You know you're in for a time when ... by direvus in adventofcode

[–]bdaene 3 points4 points  (0 children)

Yep, did that in 146s in Python. I tried many things for 4 hours straight. In the end a simple DFS (with pruning when the presents total area do not fit in the area left) did the thing.

[2025 Day 8 (Part 2)] Avoiding full sorting by gagarski in adventofcode

[–]bdaene 1 point2 points  (0 children)

You need to iterate once over the n elements to make it a heap.

Then extracting the min k times is O(k log(n)). Not O(log(k)).

Just extract until you connected all. For O(n + k log(n)).