Join the Inspire AMA with Joshua Burkhow, March 31-April 4. Ask, share, and connect with the Alteryx community!

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2024 Day 7 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2024/day/7

23 REPLIES 23
DataNath
17 - Castor
17 - Castor

Day 7 in the bag! An absolutely insane amount of time troubleshooting my part 2 macro, just to find one of my Filter tools wasn't configured properly...

 

Whole thing runs in 5.8 seconds. Was expecting a lot worse!

 

Spoiler
Day 7 - Workflow.png

Day 7 - Iterator.png

 

Hub119
11 - Bolide
11 - Bolide

Once I realized I should add a Record ID at the beginning to account for duplicate test values this wasn't too bad... was a nightmare trying to sort that problem out to begin with though. Note to self: always add a Record ID...

Spoiler
AoC D7 Pic.png
mmontgomery
11 - Bolide
11 - Bolide

Day 7. More in spoiler

Spoiler
P1: just convert possible values to rows and create formulas (one for multiplication and one for addition in rows) then iterate and sum
P2: I took waaaaaayyyyy too long to realize that there could be more than one concat, as I assumed there could only be one and lost a ton of time
Macro2.pngMacro1.pngWorkflow.png
Yoshiro_Fujimori
15 - Aurora
15 - Aurora

 

Still struggling with Day6 Part2 and skipped it for now...

 

Here is my solution for Day7.

 

Spoiler
This time I could solve Part2 with a small modification to Part1 macro.

Workflow

workflow.png
Formula to prepare Initial Values for Macro Input
[current] = ToNumber(GetWord([2], 0))
[2] = REGEX_Replace([2], "^ \d+ ", "")
[expression] = "=" + ToString([current])

Macro
macro.png
Formula to prepare values for Next Iteration

[nextNumber] = ToNumber(GetWord([numbers], 0))
[current]
  = IF [Operator] = "+" THEN [current] + [nextNumber]
  ELSEIF [Operator] = "*" THEN [current] * [nextNumber]
  ELSE ToNumber( ToString([current]) + ToString([nextNumber]) )
  ENDIF
[expression] = [expression] + [Operator] + ToString([nextNumber])
[numbers] = 
  IF REGEX_Match([numbers], "\d+") THEN ""
  ELSE REGEX_Replace([numbers], "^\d+ ", "")
  ENDIF

 

 

Qiu
21 - Polaris
21 - Polaris

Finally completed.

Spoiler
AOC2024-Day07.png
PangHC
12 - Quasar
Spoiler
part 1: take hours to found these annoying sample.
1. some rows are matched before last digit used
2. some rows are *1 in the end. and i remove for case in above... ( net total >= current total instead of net total > current total)

part 2: add the logic only will do. happy it need not to do anything
geoff_zath
Alteryx
Alteryx

Update the Text Input tool to change the parameters for Part 1 and 2.

Spoiler
AoC_2024_day7.png

 

Laurap1228
11 - Bolide
Spoiler
AOC2024_7.PNG
Tokimatsu
12 - Quasar

Done.

Spoiler
スクリーンショット 2024-12-10 100722.png

 

Carolyn
12 - Quasar
12 - Quasar

Solved!

 

I'm looking forward to looking at everyone's solutions since I could not figure out a more efficient way to solve this. My part 2 took almost 30 minutes to run :D

 

Edit: @ScottLewis did what I was trying to do. But instead of my nightmarish mess, theirs is so nice and beautiful and simple

 

Part 1: 

Spoiler
For Part 1, I used an Iterative macro to create rows with all the different combos (e.g. 19Add10; 19Mult10). My highest data line had "only" 11 spaces (12 numbers), so it was "just" 2^11 = 2048 combos

Then I ran it through a Multi-Row formula to do the math

2024-12-09_18-02-54.png

 

2024-12-09_18-03-19.png 

Part 2: 

Spoiler
For Part 2, I excluded the ones that were good from Part 1 (450 / 850), modified the macro to create a 3rd row option of "Concat", modified the Multi-Row Formula, and then prayed. 

It took 28 minutes to run Part 2. My macro spit out 7.2M combos to evaluate. It got the right answer, but oof. I'm excited to see some tricks

 

Labels