This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!
P1 not so bad. I tried to brute force P2 but figured i'd guess and check numbers one at a time to find the relationship between values
Day 21 done! Really enjoyed today. Working back from the root and building out the solver was very fun!
Macro 1 - LookupBuilder - Iterates through expressions to work out all numbers:
Macro 2 - DependencyTree - Works back from the route to find all numbers that depend on humn:
Macro 3 - HumnSolver - Iterates backwards from the root, solving for humn:
Get the impression this was super overkill but hey ho - good macro practice!
In the first challenge, I tried to clear it by brute force, but could not.
When I reconsidered, I was able to create a concise logic.
Part2: Replace Macro for Part 2: The condition for macro ending is different from part 1 macro.
Guess and Check for part2
Full workflow solutions here: https://github.com/clmc9601/Advent-of-Code-solutions/tree/main/2022%20Alteryx
workflow
Part1:
split to data with number and equation.
build a macro to replace to equation, if the equation is solvable, add to iteration until everything solved!
part1 macro
Part2:
using method learn from neural network. add the error to the number with certain percentage.
e.g. question is: find b, when 1000 - b = 100, rate is 10%
round 1: guess b = 300, then error is 600, multiply by rate, then add 60 (600*10%) to b
round 2 will be b = 360 (300+60), then error now will be 540, multiply by rate, then add 54 (540*10%) to b
etc.
the b will slowly close to correct amount.
key is the rate can't too high as we do not know what calculation taking place.
part2 macro
:-) well over a month late and Day 21 is done.
I really liked this one - a bit of tree-logic, a bit of dynamic execution, a bit of "solve for X" - what's not to love :-)
The Tree Solver:
The Solve for X: