Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2021/day/4
Fairly straight forward logic with this one, just a lot of tools to do it.
I found the work I did on the blog about trying to find the earliest you could complete a pack of Disney collectable cards I wrote influenced my approach with this one, as I straight away knew I could do it without an iterative macro.
Also nice that the solution to part two only needed a sample and sort added to solve the second part without needing to re-work the logic.
I'm looking forward to seeing more efficient solutions than this one!
Tool golf, this was certainly not. But I am super happy with how I ended up where I did - I had a vision at the start while reading through the problem about how I would need to build it, and more or less was able to build it out as I went along without too much going backwards to redo logic. ALSO I got to use my favorite dark horse tool - MAKE COLUMNS!! What a glorious end to the week.
Two days in a row of iterative macros... this is surely not going to end well. 🙂 Macro #1 for the winning Bingo card...
And Macro #2 for the losing Bingo card...
Cheers!
NJ
I could start on time today.
Macro1
GitHub
https://github.com/AkimasaKajitani/AdventOfCode/upload/main/2021
Macro-less, should work for any (reasonable) size of the bingo board...
I'm inspired by @cgoodman3 and @dsmdavid, so I made not using macro version.
I think this approach is the same of @cgoodman3 and @dsmdavid .
After I made it without macros, I realized that it was very simple.
We can calculate when the card win very easily. Because it is that we join the order to each number in the bingo and then take max order at each row and column. After specifying the win card and the order, we can calculate the required result easily.
On the star2, we know the result easily by changing the sort way.
I should know the way before going to macro route.
GitHub
https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021
Another iterative macro day! I spent WAYYYY too long working on Part2 yesterday (turns out I didn't read the directions thoroughly enough 😏) but today's was much smoother.
Another interesting one! Came up with a macroless solution. Should work for any sized bingo board.