Advent Of Code 2022 - Day 7

Finally getting organised the night before :slight_smile:
This is a thread to discuss Day 7

It is VERY important NOT to write any public spoilers :slight_smile:
ALWAYS keep spoiler stuff hidden inside one of these


This text will be hidden

which you can obtain by clicking on the gear icon


As usual, it's the one requiring recursion that has done for me :frowning:

Part 1

advent of code 2022 script pic (11)

The entire reason why I used a (line #) input, was because it wouldn't work correctly if I used a script var. I need it to reset to 1 whenever the script is first ran, then when I call (this script) recursively, it has to continue where it left off.

Man I actually love how snap keeps variable context in rings, and I absolutely love the (this script) reporter. It really makes this kind of recursion easier. I literally spent a while trying to figure out how I would be able to do it with running the block, but I couldn't find a good solution, so I decided to call (this script). It allows the (line #) variable to continue from the current line I'm on, and also when it's finished, the variable continues where it was at the end of the call, meaning, I don't need to add to it to continue at the end of a $ ls dir.

Part 2

Custom blocks are reused from part 1

Man, this was super fun.


Well done :slight_smile:

I'm going to move onto day 8 and come back to this one if I get time

Managed to do part 1 after leaving it for a day :slight_smile:

Part 1