This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
For part 1 I just used multi-row formulas to calculate everything. For part 2, I had an iterative macro and summed all the different possibilities. There are 3 dice with 3 possibilities, so 27 different possibilities. When you sum the 3 dice up, there are only 7 different outcomes (3-9) with varying chance. For example there is only 1 way to get a sum of 3 (1-1-1) but 3 ways to get a sum of 4 (1-1-2 , 1-2-1 , 2-1-1).
Another fun challenge Solved part 1 initially in a spreadsheet as it's an easy one, and I was too lazy too boot up Alteryx while still in bed, so just did it in Google Sheets on my phone, but have now retrospectively solved it with Alteryx
Part 2 took like the lanternfish and polymer days is a case of grouping together the combinations and iterating over that, which leads to a sub-2 second run time.
Macro for part 2
Chris Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
A similar approach to those above for the grouping. Although a lot less neat
For part 1 I went with a generate rows that was fun to build that keeps track of points for players, current position, last_advance, number of rolls.
Because of the deterministic dice we know that the first roll is 1+2+3 --> advance 6; the next is 4+5+6 --> 15 == advance 5; 1+2+3 --> 6 == 6 4+5+6 --> 15 == 5 7+8+9 --> 24 == 4 ..... 33 == 3 42 == 2 etc, so no need to keep track of the actual numbers, just know that the next turn the marker will advance one square less.
Recipe is kinda simple: - Work out the dice throws that happen when you roll 3 die that can be 1-3, and group them by the total sum. - in other words, 3 occurs once, 4 occurs 3 times etc. - then take the latest state of your position universes and: - Append these dice rolls (to multiply the record count by 7) - For the player who is currently taking a turn - add on the dice score and work out the position - For the player who is not taking taking a turn, leave as-is - multiply the universe count by the dice count - Summarise again by the total scores across P1 and P2 - Then reprocess any where both players have a score less than the threshold - and output any where the player score is >= the threshold (i.e. score of 21)
:-) I've included @patrick_digan 's macro that I used to find my error in this. You can see that it's pretty straighforward.
The Dice Throw:
Also relatively simple - all the work is done in the formula tool in the middle which updates the scores. - The main thing that I did differently than @patrick_digan is instead of keeping track of which player's turn it is using a turn flag, I instead looked at the Iteration Number - if the iteration number is even then it's player 1's turn, if it's odd then player 2. This is done using a mod operator. Modulus finds the remainder when dividing one number by another. This is super-common trick in computer science. Digan's trick (with a simple flag) involves much less computation I'd think - I put on a parameter for score-ceiling to be able to test with progressively higher score thresholds - I calculate the dice throws every time which is wasteful - Digan pre-calulated them and used a text input - perhaps a better answer is somewhere in the middle where we pass this in via a static input to the macro - and the great debate about vertical vs. Horizontal