Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2024 Day 14 (Base A Style)

MeganBowers
Alteryx Community Team
Alteryx Community Team

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

22 REPLIES 22
CoG
14 - Magnetar

Mixed feelings about this problem. Part 1: Another fantastic math problem - Part 2: Cool concept that was not executed well (especially based on what the actual answer is).

 

(NOT SPOILER): Immediately below is just a hint as to what to look for when doing Part 2:

Spoiler
Easter Egg.png

(SPOILER) Below is my solution to this problem with explanation for Part 1 and a short accounting of how incredibly lucky I got for Part 2:

Spoiler
Part 1 was great! Good exercise in Modular Arithmetic. Because the robot "wraps around" whenever it arrives at a boundary in the map, its position becomes its out of bounds position mod the size of that dimension of the map (101 or 103 in the case of this problem). That alone is helpful to understand, but not what makes this problem a breeze to solve. The key insight is that modulus is a periodic function and thus it is irrelevant when you move the robot. We can thus calculate all 100 steps in one Formula Tool ([Position] + 100 * [Velocity]) and then take the modulus to determine the robots ultimate position at the end of the 100 seconds. One caveat is that in Alteryx the mod() function can output negative values, which must be accounted for, and can be by performing a double modulus:
Mod( Mod( [Position] , [MapSize] ) + [MapSize], [MapSize])

The inner Mod() may output a negative number, and so by adding the modulus ([MapSize] in this case) we can correct for that guaranteeing that the output is positive. The second Mod() is needed to account for the overshooting that occurs when the inner Mod() was positive. 

From there, we calculate the quadrant, then the product of quadrant counts for the final answer!

Main.png

Part 2: Not knowing what the Christmas Tree was supposed to look like, I thought the entire map might be filled with all robots making a centered Christmas tree, implying that at least one would be at position (0,50). Second, it is true that all robots will be on their starting squares after 101*103 = 10403 seconds (so the answer had to be within this range), so I used Generate Rows Tool to calculate 9000 single second time stamps, then Filtered down to only those cases where that position was occupied, which left me with 426 timestamps to check based on my initial premise within that range. That position was 100% irrelevant to the Christmas tree, but by an act of pure providence, the answer happened to have a robot sitting at (0,50), and I found the tree. The timestamp that I found due to the periodicity of the problem, meant that I had an upper bound on what the solution could be, but not wanting to be bothered to verify, I submitted my answer, and it happened to be right. So... victory, I guess....

 

 

 

 

clmc9601
13 - Pulsar
13 - Pulsar

Shocking to suddenly see a Christmas tree in my results. 😂 I'm very pleased to have figured out the pattern!

 

Spoiler
Part 1: thankfully, my AoC experience paid off and I knew I could solve this with modulo instead of building an iterative macro. Took some adjusting to get the wrapping around the edge of the board right.

Part 2: I started out by visualizing the first 600 steps to find the pattern. I use the X and Y coordinates as spatial lat/long integers. I prefer using the Report Map tool more than the charting tools.

Want help finding the pattern? I'll include an explanation below.

Spoiler
The trick is to find the intersection of the X wraparound line and the Y wraparound line.

After looking at the first 600 steps to find the pattern, I found that my lines (y = mx + b) were as follows:
X wraparound: width of board * number of seconds + 48
Y wraparound: height of board * number of seconds + 1

I then generated the first few multiples of these lines to find the intersection.
2024-12-14_00-37-02.PNG

Surprise! Suddenly a Christmas treeSurprise! Suddenly a Christmas tree

 

ScottLewis
11 - Bolide

Part 2 is the worst Advent puzzle I have ever seen. Not the hardest, the worst. They may be going a bit harder than is reasonable on "problem cannot be solved by AI."

 

Spoiler
If you're having trouble finding the tree, try looking for horizontal lines. A line of 5+ robots should be rare in your data. I charted the 5+ line steps and looked for the tree but you could probably just look for a line of 7-10 and get it down to a single case.

 

 

AkimasaKajitani
17 - Castor
17 - Castor

Solved!

 

My Viz

Spoiler
image.png

I think part 2 is set as an easter egg so the condition is intended. 

 

Spoiler

image.png
My workflow for part 2 is intentionally a bit blurry.


Answer
Spoiler
All robot positions should be unique. Because it is an Easter Egg?
gawa
16 - Nebula
16 - Nebula

I sense too strong smell of 'anti-AI' from part2. Thanks to  @AkimasaKajitani for hints.

Spoiler
As 101 and 103 are relatively prime, positioning will repeat after every 101 x 103 seconds.
Find the timing when all robots locates at distinct positions(different 500 positions), and check how they look like. In my data, there were two. 
image.png

 (EDIT)
How to somewhat quantitatively derive answers without relying on visual aid.

Spoiler
I focused on proximity of robots when they are arranged in Christmas tree's shape.
Sum up the distance to the nearest robot for all 500 robots, and plot it by elapsed times.(Create spatial objects and use the Find Nearest tool)
Shorter distance means robots come closer and longer distance does robots locate far each other.
Obviously there exist a single minimum point that implies they come closer to make Christmas tree.
image.png
DaisukeTsuchiya
14 - Magnetar

Today's AoC was interesting.

 

Spoiler

P1 can be solved if  think carefully without rushing. However, I rushed through it, so it took me more time than I expected.

For P2, I used Map Tool and Render Tool to create a PDF for each loop and checked them. However, after outputting 5000 loops and reviewing just a few hundred pages, my hand started cramping. During this process, I noticed that vertical and horizontal stripes occasionally appeared. By analyzing their patterns, I discovered that these stripes appeared at intervals matching the number of tiles in the horizontal and vertical numbers.

The attached PDF contains only the extracted periods of these intervals. I was able to spot the Christmas tree after reviewing just 130 pages, without having to go through thousands of pages.

スクリーンショット 2024-12-14 170319.pngスクリーンショット 2024-12-14 170352.png

Yoshiro_Fujimori
15 - Aurora

Today I learned another meaning of Easter Egg .

 

Spoiler
Workflow
For Part2, I saw two vertical lines every 101 seconds.
So I added a filter to check only these images, and found a tree pattern in the 77th cycle of 101 seconds.
workflow.png

My image

tree.png

 

Goddenra
8 - Asteroid

Enjoyed Part 1! Thanks to @DaisukeTsuchiya for the hint on the key to Part 2.

dhavaldoshi
8 - Asteroid
Spoiler
Part 2: Spoiler

I didn't use any reporting tools...

Assuming you arranged the characters to see the patter in Part 1, group by times, and then try to identify which iteration has a situation where there are most number of consecutive rows which have adjacent columns captured by a robot in acending or descending order, I got a Christmas Tree which was reversed. It's not fool proof as they could have purposely left multiple trees with one level missing, but this worked for me! Hope you find the easter egg too.

 

Labels
Top Solution Authors