Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 4 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2021/day/4

25 REPLIES 25
cgoodman3
14 - Magnetar
14 - Magnetar
Spoiler
cgoodman3_0-1638596417162.png

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.

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
clmc9601
13 - Pulsar
13 - Pulsar

I'm looking forward to seeing more efficient solutions than this one!

 

Spoiler
I ended up with a brute force (rather than efficient) iterative macro. It found the solution, but it's not pretty. I just changed the filter logic to get the first bingo vs all bingos. Interface tools added later.

Screen Shot 2021-12-03 at 11.01.49 PM.pngScreen Shot 2021-12-03 at 11.08.22 PM.png

NicoleJohnson
ACE Emeritus
ACE Emeritus

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.

 

Spoiler
A disturbing amount of appends and joins... but success! 

NicoleJohnson_0-1638598628786.png

 

Two days in a row of iterative macros... this is surely not going to end well. 🙂 Macro #1 for the winning Bingo card...
NicoleJohnson_1-1638598678861.png

And Macro #2 for the losing Bingo card...

NicoleJohnson_2-1638598782448.png

Cheers!

NJ

AkimasaKajitani
17 - Castor
17 - Castor

I could start on time today.

 

Spoiler
In macro2(for star2), I take the last 1 card but do not the win number. So I added the macro 1 after macro 2 and put into only last win card and calculate it like star1.

AkimasaKajitani_0-1638598871500.png

Macro1

AkimasaKajitani_1-1638598891648.png
Macro2
AkimasaKajitani_2-1638598905711.png

 

GitHub

https://github.com/AkimasaKajitani/AdventOfCode/upload/main/2021

 

dsmdavid
11 - Bolide
Spoiler
dsmdavid_0-1638615842113.png

Macro-less, should work for any (reasonable) size of the bingo board...

https://github.com/dsmdavid/AdventCode2021

AkimasaKajitani
17 - Castor
17 - Castor

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 .

 

 

Spoiler
AkimasaKajitani_0-1638622138764.png


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

 

 

 

patrick_digan
17 - Castor
17 - Castor
Spoiler
I wasn't happy with how part1 seemed to take me way too many tools, but I was pumped that part 2 was a simple copy paste.
patrick_digan_0-1638631361185.png

 

AmandaH
8 - Asteroid

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.

 

Spoiler
Day4_Solution_AmandaHutson.PNG

Day4_Solution2_AmandaHutson.PNG

 

bflick
8 - Asteroid

Another interesting one! Came up with a macroless solution. Should work for any sized bingo board.

Spoiler
1. I parsed out all the possible winning sequences (columns and rows)
2. Joined the values from the picked number string with their spot in the selection
3. For challenge 1 grouped by table and sequence to find the min step id per for a sequence
4. For challenge 2 used the same group by as in (3), and added another group by to get the table with the largest step id for it's first sequence.
bflick_1-1638635312664.png

 

Labels
Top Solution Authors