alteryx Community

# General Discussions

Discuss any topics that are not product-specific here.

## Advent of Code 2023 Day 24 (BaseA Style)

Alteryx Community Team

12 REPLIES 12
17 - Castor

Part 1 is simple math problem. But Part 2 is not simple problem.

I made the mathematical equation for part 2, but the number is too big, so that complex formula didn't work. I wasted much time to do this.

Of course, I tried the fixed number.

Honesty, I couldn't solve this quiz without @gawa 's hint!

Spoiler
Part 1 : simple math

Part 2 :

In other programming languages, the solution would be Solver for simultaneous equations, etc., but Alteryx does not have that. So, we will use a trick (this trick does not work with the sample data because there is too little data).

Spoiler
I first considered some special cases. That is, there are several hailstorms with the same axial velocity. Let's find them first. Then, hailstones with the same axial velocity will always have a constant distance. And the distance will be a multiple of the velocity difference from the rock we throw (we use the MOD function for this).

``MOD(([px]-[Source_px]),([SPEED]-[vx]))​``

The rocks we throw are created using brute force (we are experimenting with a value of ±1000), and we find the speed at which all hailstones with the same speed meet this condition.

This gives us vx, vy, and vz for the rock.

Also, if the rock and the hailstone have the same velocity, they will only collide when they have the same initial point, so we can now find the initial value of one of the axes (in my data, the z axis matched).

Now we can solve the equation and we are done.

First, bring in the appropriate hailstone and find the collision time. This time, since I knew the initial value of z (pz), the equation to find the following t1 could be formulated by saying that the z-coordinates of the hailstone and the rock match.

t1: vz2, pz2 is the appropriate hail velocity, initial position

``([pz2]-[pz])/([vz]-[vz2])​``

Next, py. Since I knew the time, py is obtained by the following equation, where the position of the y-coordinate at time t1 coincides with that of the hailstone and rock.

``([vy2]-[vy])*[t1]+[py2]​``

Similarly, px.

``([vx2]-[vx])*[t1]+[px2]​``

Then, px+py+pz will give the solution.

The workflow for part 1 and 2.

12 - Quasar

@gawa , thanks for your hint. I could not create a part2 workflow to create an answer from input data, but I could create an answer.

Spoiler

12 - Quasar

I go to reddit and youtube for help first but it not applicable to alteryx...

alteryx do not have sympy...

Labels