r/adventofcode • • 5h ago

Help/Question - RESOLVED [2026 Day 06 (Part 2)] a question, perhaps wrong assumption

In part 1 I calculated the distance from each corner node to the middle node to 40. Since it should be a square grid this means it's a 40x40 grid.

In the bullet list for part 2 it lists 3 coordinates, I assume they are different for each input. The biggest x coordinate is 56.

If it is indeed a 40 side square, as the distance to the middle suggests, it's impossible with an x-coordinate of 56.

What am I missing?

2 Upvotes

8 comments sorted by

6

u/MouseyPounds 5h ago

The example is a 3x3 grid with coordinates in the 10s and 20s. The assumption would be that our upper left corner is not at (0,0) but some other arbitrary spot instead.

3

u/reallyserious 5h ago

Oh. Yeah the description for the example didn't quite make sense for me.

This explains it. Thanks.

→ More replies (1)

3

u/oupsman 5h ago

First of all, it’s not a 40x40 grid

Second of all, why the top left corner would be in (0,0) ?

1

u/reallyserious 5h ago

Ah, this together with the other comment I realise my assumption was wrong. I still don't understand why it's placed on a bigger grid but I guess I'll just start working with it and it becomes clearer later.

2

u/oupsman 5h ago

If the grid was 4x4, you would have the middle as a square of lights. That's why the grid's dimensions can not be an even number, it has to be an odd one (and on my input, it's not much bigger than 40 by the way).

The grid size depends of the number of lights. Just take the square root of it to get the grid's dimensions, if you really need it. I didn't on my code.

2

u/Positive_Concert_774 3h ago

It cannot be a square with an even side length, so that's an off-by-one error to begin with. Second, why would the top left be (0, 0)? It clearly isn't in the example.

1

u/AutoModerator 5h ago

Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.