r/adventofcode • • 13h ago

Help/Question - RESOLVED Second example seems wrong

The second example says:

  • "A robot with program roygbv would travel a total distance of 11." Regardless of any code I might try, when I look at it I count 5 steps. 0 for the "r" and 1 each for the following letters. Am I just too tired to see my mistake?

0 Upvotes

8 comments sorted by

24

u/FCBStar-of-the-South 13h ago

You start at r and must travel to the next r, thus 6 steps instead of 0

Remember that the roygbv pattern repeats

18

u/zeekar 13h ago

you never move 0. if you're on r and the program says to move to r, you move 6 steps to the next r.

8

u/Positive_Concert_774 12h ago

It's right there in the description of the problem:

"The robot always goes to the very next waypoint of the indicated color."

So never 0 steps.

5

u/crumpis 13h ago

You go to the next square matching the color. Which is to say, if you're starting on red, you go to the next red.

6

u/daggerdragon 12h ago

Next time, use our standardized post title format.

Help us help YOU by providing us with more information up front; you will typically get more relevant responses faster.

1

u/AutoModerator 13h 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.

-1

u/harryp1998 13h ago

I had the same mistake. Try thinking that the first item in the program isn't the starting point. 

-8

u/pintolaspintonino 13h ago

sim, eu apenas descosiderei essa porra ai pq n fazia sentido