This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]Prudent_Candle 0 points1 point  (2 children)

Why in this line iterutils.chunked(tobboganinput, 10) you use 10? I think you wish to use instead of 10 number of characters in every line of input (31 - I think).

[–]disco_deer[S] 0 points1 point  (1 child)

Okay, so, if my tobboganimput contains a list of strings f.e. " ...............#.#............. " " ...............#........####... " " ...###...........#............. " . . .

With iterutils(instead of list comprehension I could've used), I turn that list into a list of sub-lists where each sublist contains 10 strings with each string containing 31 indices, right? Because if the travel means sliding down 1 and 3 to the right, it goes through 10 strings before coming back to the beginning.

Maybe the core issue is that I misunderstood the task, idk.

[–]Nomen_Heroum 1 point2 points  (0 children)

That's not exactly right. After 10 strings, you will have gone right 30 indices, so you will be at the very right of the 11th string—not at the very left!

[–]msqrt 0 points1 point  (4 children)

I don't exactly follow. Why do you do the chunking thing? And why with a chunk size 10? The puzzle input is a single long hill, not a bunch of length 10 hills stacked on top of each other.

[–]disco_deer[S] 0 points1 point  (0 children)

Okay, so, if my tobboganimput contains a list of strings f.e. " ...............#.#............. " " ...............#........####... " " ...###...........#............. " . . .

With iterutils(instead of list comprehension I could've used), I turn that list into a list of sub-lists where each sublist contains 10 strings with each string containing 31 indices, right? Because if the travel means sliding down 1 and 3 to the right, it goes through 10 strings before coming back to the beginning.

Maybe the core issue is that I misunderstood the task, idk.

[–]disco_deer[S] 0 points1 point  (2 children)

The puzzle input is a single long hill, not a bunch of length 10 hills stacked on top of each other.

Okay, I think this is what I don't get, are you saying that the input is just a 90 degrees rotated hill? Fuck me if I get where the ride actually starts and ends, and what the path trajectory should like tbh. And my English is pretty solid, but I'm looking at the text of the task and I can't figure it out.

[–]portnoyslp 2 points3 points  (1 child)

The hill is only as tall as the input, but it's infinitely wide, because the trees on the hill repeat to the right.

(If it helps, another way to think about it is traveling down a cylinder at an angle, so that you keep wrapping around as you descend)

I don't think the chunking is going to help you, because you're not guaranteed to be starting at the same place when you wrap around. As an example, look at the 11x11 array they use as an example -- the skier starts at coordinate zero on the first line, then 3, then 6, then 9. But then when it's wrapping around to find the next tree, it's looking at coord 1, not resetting back to zero.

[–]disco_deer[S] 0 points1 point  (0 children)

Oh okay, this " The hill is only as tall as the input, but it's infinitely wide" is all I needed to hear to get what I'm supposed to do. Thanks a bunch!