Advent of Code 2024 Day 7 (BaseA Style)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2024/day/7
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 7. More in spoiler
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Still struggling with Day6 Part2 and skipped it for now...
Here is my solution for Day7.
Workflow
Formula to prepare Initial Values for Macro Input
[current] = ToNumber(GetWord([2], 0))
[2] = REGEX_Replace([2], "^ \d+ ", "")
[expression] = "=" + ToString([current])
Macro
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Finally completed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Done.
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
Then I ran it through a Multi-Row formula to do the math
 
Part 2:
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
