The solution to last week's challenge is HERE!
This year at Inspire, our attendees’ ability to win games of chance will be tested – and not just because of the Las Vegas venue! The ability to obtain the hottest Alteryx swag will be decided by a round of Plinko at the Community hub. Can you use Alteryx to break down the probabilities of our board and ensure your odds are the best possible?
There are no start files to this week’s challenge - any workflow or app that assigns relative probabilities to the final outcomes of the board above will suffice!
I've taken a very rudimentary approach...
Needless to say I learned a lot more about Pascal's Triangles with this week's challenge. After some false starts I decided to use an iterative macro to get my results. I'm posting my solution now, but will clean it up a bit, add details and then repost it. My %'s are different than @patrick_digan so we'll need some additional responses to get some sort of consensus on the %'s. There is a 13.4% chance of puck starting in the 4th slot and ending up in the 2nd bucket as per the picture.
This was definitely a challenge worthy of being presented during Inspire17!
Alright, @MattD - I will admit that I felt like it would be cheating to sit in on the Weekly Challenge session at Inspire this week. But then we started getting into Pascal's Triangles and API's and lions and tigers and bears... oh my. Not nice. Then @EstherB47 and I spent the better part of the rest of Tuesday trying to figure out how to recreate Pascal's Triangle from scratch in Alteryx... So thanks for that :)
Anyway. Here's my solution! Bit of a different approach from @alex and @patrick_digan, I went with an app that prompts you for the number of Plinko slots & rows (so it's variable, you know, for bigger Plinko boards... because bigger boards = more cool prizes!). Then you select which slot you want to place your coin into, and it will spit out a report that tells you the probability of winning each prize.
Phew. 6 days in Vegas + Challenge 73 = skin AND brain are officially fried! Thanks for the great challenge!
PS. @JoeM - Look! I did an iterative macro!!... But I still want to pick your brain, because I'm afraid this may have just been an "I just accidentally clicked the right combo of things" situation... :)
I've cleaned up the original workflow and macro plus added descriptions of the formulas and processes I used to get my results. I also added options to change the number of slots and decision points (pegs). I couldn't have done it without modeling it and testing my thought process in Excel. I often have to first think about how I would create solutions in Excel to be able to create them in Alteryx.
Hope you find this solution helpful. Thanks.
Use the old combinatorial mathematics to workout the number of combinations for each slot and then divide by the total number of possible routes (2^8) for the probability. If there were no boundary the number of combinations would be 8C4 (=8!/4!/4!) for any slot directly under the placement, 8C3 for the slot left of the placement, 8C2 for the slot 2 places left of the placement, etc. Taking account of the boundary you need to add the combinations of the slot opposite the current slot if no boundary existed. So, for example, a counter placed in position 1 and landing in slot 1 the total probability would be (8C4 + 8C3)/2^8 and for position 1 and slot 2 the probability is (8C5 + 8C2)/2^8... Unfortunately I found it tricky to generalise for all cases. So I resorted to Method 2...
Build your own Plinko Game in Alteryx and run it multiple times...
I simulate the 50/50 probability of the ball falling one way or the other using a filter tool with the expression rand() <0.5 and just union it all together in the right places. I set it as an iterative macro to run 1000 times and run in this workflow (see below) to get...
This method is numerical so results are approximate!
In case anyone is taking the formulaic approach and needs help calculating factorials! https://gallery.alteryx.com/#!app/Wolfram-Alpha-Connector/59405f3ea18e9e02406720db
We're leaving this exercise open until next Monday, so keep the solutions coming! :)
So i went with a low labor approach after thinking about ways to needlessly over complicate this. First challenge for me, so lets see how it plays out!
I started by observing that you can break the plinko board into 4 identical groups. Each group has 5 slots of input, goes through 6 slots in the middle, and then outputs through 5 slots in the bottom. The 5 output slots are also the 5 input slots of each next group. Then, assume that any input with two lower outputs (e.g. every input in the 5 slot row, and all but the two outside edges in the 6 slot row) has a 50% chance of going into either output, and that the edges in the 6 slot row have a 100% chance of going into the lower row. This means something entering in slot 1 of a 5 slot row has a 75% chance of exiting in slot 1 of the next 5 slot row, and a 25% chance of exiting in slot 2, and something entering slot 2 has a 25% chance of exiting in slot 1, 50% chance of exiting in slot 2, and 25% chance of exiting in slot 3.
I built a formula in excel for each of the 4 groups of 5-6-5 slots, and used a random value for each group to determine what the output would be. Each groups output is the input of the next group. I actually built this two ways, one way performed all of the math in a single formula node, while the second way used four separate formula nodes.
By using create rows, I was able to run a simulation of 1 million attempts for each starting position per workflow run. Method 1 took about 27.2 seconds, and method 2 took about 32 seconds. For the sake of comparing my results with other attempts, in both of my methods, a chip dropped into slot 4 at the top had a 10.9% chance of landing in slot 2 at the bottom.
As a side note: i used only greater/less thans, without anything to capture random numbers equaling .25 or .75. I set any of those results to a 9, and like to think of that as the weird case where it balances on the pin and doesn't fall all the way through. It seems to happens once every 5 million runs!
Edit: hey i figured out spoilers!