General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.

Advent of Code 2021 Day 17 (BaseA Style)

jdunkerley79
16 - Nebula
16 - Nebula

Discussion thread for day 17 of the Advent of Code - https://adventofcode.com/2021/day/17

11 REPLIES 11
SeanAdams
17 - Castor
17 - Castor

My solution was very similar to @NicoleJohnson - ran in 7.2 sec on my laptop with AMP turned on.

 

Spoiler
Rather than trying to find every combination of Vx and Vy - the fact that that they are independant means that you can narrow the search space substantially by:
- Search for all values of Vx that get you into the target zone
- Do the same for Vy
- Only now look at combinations - much smaller search space.




SeanAdams_0-1640053967939.png

 




Pang_Hee_Choy
10 - Fireball

thanks @dsmdavid for the quick way. 

 

Spoiler
overall the idea is similar as i refer to them😅.

but once i get the answer, and i realise macro will save more time. 

As brute force may have lot of waste calculation, Mass Steps, Mass Initial X and Initial Y.
like target X and initial x are 200. it only need to calculate for 1 step, but due to brute force. it calculate 100x useless calculation.
like target Y is -155, it need to stop if Y is pass that location. and same, brute force, it calculate lots of useless calculation.

with iteration macro. both situation can avoid and run the workflow faster.
Pang_Hee_Choy_0-1641549774833.png
Pang_Hee_Choy_1-1641549787280.png