General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 17 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

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
12 - Quasar

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

 

Labels