Advent of Code 2023 day 8 NO SOLUTIONS :thread:
# advent-of-code
d
Advent of Code 2023 day 8 NO SOLUTIONS đŸ§”
I'm curious to know if I misunderstand something about this puzzle: are you supposed to follow the entire list of directions fully each time (so if it's RLR always do RLR, then check), or are you also supposed to check after each single step if you are finished (for part 2)?
p
Each R or L moves you to a new node, it's on each node that you check.
n
It is not mentioned in the task, but it seems that you cannot finish unless you followed the entire path one or multiple times
s
At first I implemented the check for each step of the path, but then it turned out that (at least for my input) the termination node is always at the end of the path.
d
Yeah that is kind of my suspicion so I'm not sure if it's a coincidence or intended
m
The puzzle wording suggests to check after each step, so why would anyone even begin to think that it is not necessary?
s
Well, it says
repeat the whole sequence of instructions
, which I understood as you always need to run the set of instructions till the end, maybe multiple times.
😼 3
d
That, and each of the examples have it so it completes after having performed the entire sequence of steps
n
Oh, it really does mention “repeat the whole sequence of instructions”. That was easy to miss
p
I took that to mean "if you run out of instructions before reaching the end, then repeat them"
d
I wonder at what order of magnitude I can expect for part 2, is it in the millions, billions, or ...?
s
Around 10^13 for me.
d
😧
My (not yet validated) assumption is that there will be cycles and that I'm to use the least common multiple of the lengths of these cycles, but not sure if it's correct and how to implement it, but I'll think on it a bit more
đŸ€ž 3
a
I hope that's not too much of a spoiler but the input does have some properties that are not mentioned in the problem description
k
Copy code
Of course, you might not find ZZZ right away. If you run out of left/right instructions, repeat the whole sequence of instructions as necessary: RL really means RLRLRLRLRLRLRLRL... and so on.
as neccessary
n
“repeat the whole sequence *as necessary*” can be interpreted in at least two different ways. But it seems that this wording implies that the sequence should be repeated in it’s entirety as many times as needed
k
hm, right. but still to run out of instructions I understood that I am consuming them by one
d
Okay I finally solved it, I'll head over to the other thread 😄
🎉 3
e
I asked ChatGPT today if there is a Greatest Common Divisor function in Kotlin standard library, it said kotlin.math.gcd. And it started to make excuses after
n
I’ve been using a bit of chatGPT to help me when I inevitably make a wrong turn in Rust. Overall it’s pretty impressive, but yeah sometimes it makes stuff up.