Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #161: Triangles, Triangles, Triangles

JoeM
Alteryx Alumni (Retired)
The idea of the challenge is simple, but it could be a little trick to execute!
 
Provided are a set of coordinates. With this set of triangles, you must create triangles. Each triangular spatial object must have exactly 3 non-collinear points. With this data set, you should create 516 unique triangles! How many of the 516 can you get?
 
 
This week's challenge was contributed by @CharlieS !
 
 
patrick_digan
17 - Castor
17 - Castor

Fun challenge @CharlieS 

Spoiler
While I naturally reach for the spatial tools, the formula tools can accomplish the same tasks without transposing the data.
Capture.PNG
T_Willins
14 - Magnetar
14 - Magnetar

Fun challenge!  Last filter needed to match solution, but shouldn't tiny triangles still count?  Investigation of original data indicates these are non-linear points (Thank you Mr. Coss - High School Geometry Teacher)

 

Spoiler
 Workflow 161.GIF

 

 

CharlieS
17 - Castor
17 - Castor

I'm delighted that I could contribute to the awesome-ness that is the Weekly Challenges! I originally designed this with several sub-challenges if you want more:

 

- Draw a triangle using Spatial tools

- Draw a triangle without using Spatial tools

- Draw multiple triangles using only a single tool

- Draw multiple triangles using an iterative macro

- Draw all 516 unique triangles

 

 

A note on the "valid" solutions: due to how the points were drawn, it is possible to produce some very thin triangles that would be collinear if a grid was drawn on a Cartesian plane. Rather than adjusting the points, I was curious to see different approaches to handing these scenarios. 

Thableaus
17 - Castor
17 - Castor

Challenge #161, done.

 

 

Spoiler

I also removed the tiny triangles to get to the final answer - (unsure why they don't count)

 

 

 

Challenge_166.PNG

 

Cheers,

TerryT
Alteryx Alumni (Retired)

Fun challenge!  Thanks @CharlieS 

 

Spoiler
challenge_161_TTT.PNG
cplewis90
13 - Pulsar
13 - Pulsar

Fun challenge! I had to look up (as I couldn't remember back to high school trigonometry how to determine if 3 points were collinear.

Spoiler
After doing some digging (looking at 3 points that are seemingly a straight line), I understood why I couldn't use 0 as the collinearity check. Some of the areas are basically 0, but are not really triangles as they appear to be lines on the plane.
Challenge 161.PNG
Ladarthure
14 - Magnetar
14 - Magnetar

Fun challenge, I had troubles for the final filter :)

RolandSchubert
16 - Nebula
16 - Nebula

Interesting. Final filter was a challenge

Spoiler
23-04-_2019_09-05-39.png
First tried to filter triangles using ST_DIMENSION (should return 1 for lines)
NicoleJohnson
ACE Emeritus
ACE Emeritus

OK so I got a bit hung up on the definition of "Non-Collinear", so my workflow actually has 2 solutions - one that gets 516 unique triangles (not the most efficient solution compared to others, but logically it got me there, and I feel like my high school math teacher wouldn't have been mortified, so I'm okay with it)... and then an alternate solution that I feel better matches the intention that all triangles be "non-collinear", which I defined to mean that there could be no point in the triangle that was at the same latitude or longitude plane as any other point in that triangle. Results in far fewer triangles (essentially, any triangle with a straight vertical or horizontal side is eliminated by this method).

 

Either way, super fun challenge @CharlieS!

 

 

Spoiler
Method #1: Create 516 unique triangles... realized after looking at a few other solutions that the Unique tool would have greatly simplified this, but it got me there eventually (basically reordered the points in ascending RecordID order and then grouped them to eliminate duplicates, achieving the same effect... with way too many tools haha).
WeeklyChallenge161.JPG

516TrianglesSolution.JPG

Method #2: Create only triangles that do contain any points that are on the same plane (latitude or longitude). Again, a bit of a roundabout way to get there (once again finding an obscure reason to use one of my hidden favorite tools, Make Columns!)... but conceptually this one was actually easier for me to wrap my head around. And since I cheated a little by borrowing the Unique tool from other solutions as my method to get rid of duplicates, I opted to not use any Spatial tools for this method, using the Spatial formulas instead. BONUS: The resulting picture of triangles with this method is quite pretty! :)
WeeklyChallenge161Alternate.JPG

NonCollinearSolution.JPG

Cheers,

NJ