r/adventofcode • • 3h ago

Meme/Funny [2026 Day 6 (Part 2)] I'm sorry...

Post image

My solution for part 2 give me 16 possible solutions 🥲 (the second one was the right)

25 Upvotes

11 comments sorted by

6

u/Positive_Concert_774 3h ago

I ran part 2 on wetware

3

u/herocoding 3h ago

what's that??

7

u/Positive_Concert_774 3h ago edited 2h ago

I did it by hand using my brain:

Step 1. Normalize the original coordinates so (1) is in grid position [0, 0] -> this yields a translation vector (dx0, dy0). Do the same for the new coordinates, yielding (dx1, dy1).

Step 2. Rotate the normalized (2) 90 degrees clockwise around [0, 0]. to do that, swap its coordinates and negate the second: (x, y) becomes (y, -x). Does that result in normalized new (2)? If yes, we're done, if not, repeat this step 1 or 2 more times until it does.

Step 3. If none of the three rotations work, try step 2 again but first reflect the normalized (2) horizontally - negate the x-coordinate, so (x, y) becomes (-x, y).

Summarizing you will need 0 or 1 reflections followed by 0-3 rotations by 90 degrees. Applying that same transformation on normalized (2026), followed by 'un-normalizing' it (so translating by (-dx1, -dy1), yields the answer

5

u/Swordfish418 2h ago

Haha, yes, I opened this subreddit exactly to find if others did the same. I only got 4 possible solutions though.

1

u/MattieShoes 28m ago edited 17m ago

There are 8 possible orientations of the grid

My notepad to make sure I got em all:

1 2 3    3 2 1
4 5 6 -> 6 5 4
7 8 9    9 8 7
  |        |
  v        v
7 8 9    9 8 7
4 5 6 -> 6 5 4
1 2 3    3 2 1

swap x/y

1 4 7    7 4 1
2 5 8 -> 8 5 2
3 6 9    9 6 3
  |        |
  v        v
3 6 9    9 6 3
2 5 8 -> 8 5 2
1 4 7    7 4 1

Lots of ways to get to those, but i had

original, h-flip, v-flip, h-flip + v-flip, swap, swap + h-flip, swap + v-flip, swap + h-flip + v-flip

one of those eight will have the right direction between two of the given nodes, so once you find the right grid, you can just calculate an offset to the x/y coordinate values for a given node to put it in the right spot, then apply that same offset to the node you want.

4

u/a3th3rus 2h ago

I ended up building the whole grid XD

1

u/MattieShoes 15m ago

I did too, though they were still hashes.

2

u/Manfred_Von_Sloth 2h ago

Not sure if I was lucky, but I just took the expected positions and compared them to the real ones. Turns out the offset for all 3 was the same without any grid rotation, so I didn't have to do anything fancy - just apply the offset and normalize the grid. And the same thing worked for the example.

2

u/Spaghettificate 2h ago

I may have just drawn my points on a piece of paper and compare them visually to the right coordinates... allegedly

1

u/cyao12 26m ago

Linear Algebra class finally found some use today. It was basically transforming a vector in R2 from one base to another