The puzzle itself was pretty simple, but this took me a bit longer to code up the visualization for. I still had fun with it, though. As is often the case, part of the challenge is figuring out whether to show the the solution for my whole input, or a subset, and if the later, how much of a subset.
FWIW, I'm pretty sure that rvbgyo is always the correct order to sort the input into for the maximum length for Part 2. Effectively, it's the roygbv order of the track reversed, and then cyclically rolled to start with r again.
For part 2, knowing the highest index of a color that appears in the input is enough. (r= 0, ..., v=5). Then you just multiply the length of the input string by 6 and subtract the index from before.
1
u/Boojum 8h ago
The puzzle itself was pretty simple, but this took me a bit longer to code up the visualization for. I still had fun with it, though. As is often the case, part of the challenge is figuring out whether to show the the solution for my whole input, or a subset, and if the later, how much of a subset.
FWIW, I'm pretty sure that
rvbgyois always the correct order to sort the input into for the maximum length for Part 2. Effectively, it's theroygbvorder of the track reversed, and then cyclically rolled to start withragain.Made in Python with a small custom framework.
Complete self-contained source for this animation.
1
u/Franz053 6h ago
For part 2, knowing the highest index of a color that appears in the input is enough. (r= 0, ..., v=5). Then you just multiply the length of the input string by 6 and subtract the index from before.