Advent of Code 2023 - Day 4

This is a thread to discuss Day 4

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


Good luck :slight_smile:
FYI one of the features of Advent of Code is that we all get given different inputs so our answers will be different.
The examples are all the same but each of us gets different inputs for us to solve

Part 1 done but I've having trouble using the pipe command - I keep getting errors when I use it so just using my usual repeating technique of repeatably modifying my result list

Aaah - Part 2 is one of those ones where the simple brute force approach might take too long to complete - been running for 5 mins and only up to item 19 of 199 and it's getting worse each time!

Going to set it running in a VM just to see if it ever finishes and then carry on main machine trying to find a more efficient method

[edit 5 mins later] - didn't take too long to make it MUCH faster - all done now :slight_smile:

This one wasn't actually very hard, although part 2 was much harder.

Part 1

Part 2

My original idea was to put the for each loop in a map, and modify the list, but then I realized that was a bad idea, since map creates a shallow copy of the list, and I would be putting a command block in it (which is fine in some cases, but not in this case).


Snap! Build Your Own Blocks

Part I

A bit of whining ...

As for part 2, I'll surrender. I'm not a native spiker and have a hard time trying to understand the details of the problem description, e.g.

scratchcards below the winning card

below on the list => the next consecutive card numbers

one copy each of cards

for me, it's hard to understand this idiom as a one copy of each of the cards.
And so on...

Good luck :wave:

Updated Part II

Initial count

With bonus card added


Honestly, I'm a native english speaker, and even I had to read it many times to understand it.

Are you talking about the SET INPUT TO PIPE... script, first thing in the scripting area? If so, I'm not surprised you had trouble -- it gives me a headache reading all those nested HOFs, because I don't know what the data structure looks like. If you could show me the simplest example that fails, and then show the alternate code that didn't fail, I could try to figure out what's tripping you up.

Thanks for the offer

I'm giving it a go again on another Day's puzzle and I'll shout out if I can't grasp it again :slight_smile:

All worked fine on Day 6 Part 1 puzzle :slight_smile: