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 - Base A Style! (Post 2 of 26)

14 - Magnetar
14 - Magnetar

In case you missed it, read what this is all about here.  Want to join our leaderboard? Go to https://adventofcode.com/2019/leaderboard/private and use the code 453066-ca912f80.

One cool thing about this project is that everyone gets their own unique set of inputs, so our answers won't actually match each other.

So now let's dive into the challenges.

Day 1 - The Tyranny of the Rocket Equation 

0.8 seconds to run!

 

Oh cool. Looks like a pretty soft launch. Take some numbers, divide, and round down. I should be able to do this in a single formula tool. Then, a summarize tool will take care of the total.

 

How do we lop off the decimal? Don't want to round, so I rely on the handy FLOOR function. This is a favorite. Basically cuts off the decimal altogether.

EstherB47_0-1575859573078.png


Since it's midnight on a Saturday, I'm hoping that it won't take long to solve. And it doesn't. Sub 2 minutes. Patting myself on the back, I foolishly think that I may be on the general leaderboard. Nope. Over 100 people solved before I did. Wow. So how did I track against Alteryx users? #2. Pretty happy with that!! But soon realize that this whole process will be, in no way, me trying to get on the leaderboard. I'm happy with completing the days, and sharing my thoughts and processes along the way.

Please join in with me!

Now on to part 2.....

We learn that fuel requires fuel, so we have to keep doing the formula above until we hit zero or a negative number. Getting loopy!! It's time to make this a macro. I chose an iterative macro in order to loop through each number until it's low enough. The macro itself is super simple. Same exact formula. Check if the result is zero or less, and iterate if it isn't. Write out everything to the output, but iterate only on the reduced number.

EstherB47_1-1575859673968.png

Took another 2-3 minutes to build this macro. Very fast run time.

Cheers!
Esther



Highlighted
15 - Aurora
15 - Aurora

@EstherB47  thanks for putting these recaps together!

 

For part 2, I opted for a generate rows solution. 

 

https://github.com/patrickdig128/AdventOfCode2019?files=1

 

Highlighted
11 - Bolide

My solution for day 1 was basically the same as @EstherB47's.

 

I really liked @patrick_digan's solution, though, because Generate Rows is a rarely-used tool for me. My mind went directly to an iterative macro, so I wouldn't have thought to use Generate Rows to iterate until a condition is met (which is exactly what it does!)

 

My Advent of Code solutions are on github here: https://github.com/kelly-gilbert/advent-of-code/tree/master/2019-alteryx