Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2024 Day 10 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

27 REPLIES 27
gawa
16 - Nebula
16 - Nebula

I thought part2 would be more complicated scenario, but actually not so much.

Spoiler
Simple approach to track next position in each iteration. As height increment is always "1", 9 iteration suffices.
image.png
CoG
14 - Magnetar

As suspected, @gawa, copied my solution before I even finished it XD. Well done, sir! This was a surprisingly simple problem (maybe could have swapped for Day 6?). Another excellent algorithm lesson

 

 

Spoiler
Both parts of this problem are solved via an algorithm known as Breadth First Search ([BFS]: where all nearest neighbors are evaluated for every point in the queue, valid next steps are kept, and all other paths are terminated). To use this problem as an example start with all 0's (Trailheads) in the dataset, and create an iterative macro that does the following: first, check the left, right, top, and bottom neighbors for all 0's, only keep 1's, on the next iteration do the same, but only keep 2's, etc. until 9, at which point you are done. This output actually solves Part 2 first, with part 1 needing a little bit of extra work to achieve the answer. Simple problem + simple workflow = Great Day!

Main Workflow:
Main.png

BFS Macro:
Hike.png

 

 

 

gawa
16 - Nebula
16 - Nebula

I always spy on you @CoG.

We will see more copy of them in this thread because this should be the most immediate approach that first comes to our mind.

ScottLewis
11 - Bolide

The best part2 is the one you already solved while doing part 1. 

 

Spoiler
This one lined up with the way I like to work with grids. Also highlights how it is sometimes easier to just code all the cases than get fancy with generate rows and associated formulas.
Sadly, a Macro input configuration caused me to have to rebuild the macro and kept me out of 1k again. The struggle continues.

 

Spoiler
Day10Scott.PNG

Day10MacroScott.PNG

 

 

PangHC
12 - Quasar

today challenge is like design for alteryx. 

 

just a tool different, so i use detour instead.

Spoiler
part1: loop 0 to 9, use summarise to unique the same location

part2: do not unique it. (which for me, do not summarise it.)

Screenshot 2024-12-10 140815.pngScreenshot 2024-12-10 140805.png
AkimasaKajitani
17 - Castor
17 - Castor

Solved!

 

Today is straightforward!

 

Spoiler
image.png

image.png

ntakeda
12 - Quasar

My solution.

Spoiler
2024-12-10_15h18_15.png2024-12-10_15h19_14.png

  

  

DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

Day 10 is easy. I can sleep tonight.

Spoiler
スクリーンショット 2024-12-10 160251.pngスクリーンショット 2024-12-10 160316.png
LHolmes
9 - Comet

I *distinctly* remember someone (looking at you @CoG ) telling me to read the constraints carefully. I think many people (including myself) solved part 2 first 😂

 

Spoiler
Since I'm tired and didn't annotate my flow:

Added a "y" coordinate with 1st record tool
Regex Tokenize to Rows on \d
Select Tool to change the Topo field to byte
Multi-Row Grouped on "y" coordinate to add "x"
Split Trailheads (0's) from Trails and give each a TrailheadId
Send trailhead to macro and rest of trail to second input for macro
In the macro take the coordinates from the head and determine 1 left, right, up, and down (formula). Don't forget to constrain your moves to the First-Last Column and Row. Don't want to go out of bounds. Achieved with IF statements.
Join new coordinates to trail set
Use Filters to keep only the next relevant Topo value. Here is here iteration number is valuable for increasing the value dynamically each run.
union all the True streams (Of course I could have applied union first and used less filter tools, but meh - again tired.
Check to see if you've reached the last Topo level and send to output, otherwise return to run the next level.
Coming out of the macro you have ALL possibilities to get from a Trailhead to 9, but Part 1 wants Trailhead to Unique 9's. So apply a Unique tool by TrailheadID on the coordinate for level 9. Answer is record count.
For part 2 the ask is to sum the ratings which is made up of ALL possible paths to get from Trailhead to a 9. So take the pre-Unique tool record count..

Day 10 Part 1 & 2 w Iterative MacroDay 10 Part 1 & 2 w Iterative Macro





Labels
Top Solution Authors