General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2023 Day 4 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

48 REPLIES 48
JarrodT
Alteryx
Alteryx

I accidentally mislabeled my batch macro, so had the opportunity to use "Find Missing Macros" function, which worked beautifully. I went the route of a batch macro with a nested iterative macro - not sure both were needed, but it gets the job done. 

Spoiler
image.png
NicoleJ
Alteryx
Alteryx

Another fun one! AND it's macro time... I do love a good iterative macro in the morning!!

 

 

Spoiler
Part 1 was pretty straightforward solve, used my new GetPart formulas for the initial parsing into cards > my hand > winning hand, and then fun to find an excuse to use the POW function (ka-POW!!!!)

Part 2 ended up being simpler than expected once I paused and made sure to annotate a few things and understand my steps first before launching into my iterative macro. I love a good iterative macro use case, and this was a perfect one!!

Day4.1.png
Day4.2.png

 

Cheers!
NJ
Sr. Manager, Product Management, Designer
Alteryx
mmontgomery
11 - Bolide

Day4. I Macro is brute force to solve it 'faster'

 

Spoiler
Day4_base.pngDay4_I_macro.png

 

 

patrick_digan
17 - Castor
17 - Castor

Similar non-macro as @Pang_Hee_Choy . I'm forever grateful to @danilang who showed me the power of the multi-row formula tool for the AOC challenges many years ago. 

Spoiler
 

image.png
image.png

Kenda
16 - Nebula
16 - Nebula
Spoiler
attempted to go the non-macro route at first then threw that idea out the window
image.png

image.png
 
DavidP
17 - Castor
17 - Castor

Not my best work, but it's done! Iterative macro took 13 minutes to run, but I don't care!!!

 

Spoiler
aoc d4.png

aoc d4 macro.png
Carolyn
9 - Comet

Oof - I predict I'll be good at Iterative Macros by the time the challenge is finished. Thanks to @phottovy for posting your solution file. After my attempts failed miserably, yours was super helpful! We'll see how it goes next Iterative Macro challenge, but I feel like I understand them way better than I did 2.5 hours ago :) 

 

Spoiler
2023-12-04_09-31-42.png


2023-12-04_09-31-33.png

  

afv2688
16 - Nebula
16 - Nebula

This one took a while to think how to do it with no macro :)

 

Spoiler
Sin título.png
FrederikE
13 - Pulsar

 

Spoiler
Screenshot 2023-12-04 193018.png

Screenshot 2023-12-04 193101.png

  

mceleavey
17 - Castor
17 - Castor

Ok, so my iterative macro was being extremely naughty, and so I set it on fire and used a macro-free brute force approach.

Don't judge me.

Spoiler
Screenshot 2023-12-04 191024.png
The first part was really easy. I simply stripped out the component parts, split to rows so I had a winning number per row and filtered to where one of my numbers was the same as a winner. I then simply multi-rowed a double calculation per card and boom.
Part two was a bit frustrating as I probably messed up something very straightforward with my iterative macro. The initial design simply ran through for each card number and generated the rows for each one, I then stripped out the originals and unioned the output back to the initial stream but it kept giving me extra rows and I couldn't figure out why, so I threw my hands up in the air in exasperation and brute forced it with an inelegant multi-row, using a look back for the number of rows representing the possible number of wins (10):
(if [Row-10:Count]-10>=0 then 1 else 0 endif) * [Row-10:Wins] +
(if [Row-9:Count]-9>=0 then 1 else 0 endif) *[Row-9:Wins] +
(if [Row-8:Count]-8>=0 then 1 else 0 endif) *[Row-8:Wins] +
(if [Row-7:Count]-7>=0 then 1 else 0 endif) *[Row-7:Wins] +
(if [Row-6:Count]-6>=0 then 1 else 0 endif) *[Row-6:Wins] +
(if [Row-5:Count]-5>=0 then 1 else 0 endif) *[Row-5:Wins] +
(if [Row-4:Count]-4>=0 then 1 else 0 endif) *[Row-4:Wins] +
(if [Row-3:Count]-3>=0 then 1 else 0 endif) *[Row-3:Wins] +
(if [Row-2:Count]-2>=0 then 1 else 0 endif) *[Row-2:Wins] +
(if [Row-1:Count]-1>=0 then 1 else 0 endif) *[Row-1:Wins] + 1

...which made my brain hurt so I need to lie down.

Still irritated as to why my iterative didn't work...

 

M.



Bulien

Labels