Welsh Piper's imploding dice

Welsh Piper's imploding dice

Return to topic list

Fri May 1 00:12:19 2020   by   morethanpixels
Help! Would someone use this attempt at pseudocode to make Troll code so we can see the probability distribution? I gave it an honest effort, but saw rather more frustration than progress.

/ Inspired by ... https://welshpiper.com/imploding-dice/
/ while CR < mark, keep rolling and accumulate total; CR is the current roll

/ definitions and first roll; using d10 as an example

assign d10 to CR, assign CR to mark, assign CR to total

/ subsequent rolls, if any

assign d10 to CR
IF
CR < mark
THEN
add CR to total
assign CR to mark
[repeat/recursion to keep going]
ELSE
[done]

I wouldn't be surprised if I'm missing a simple & elegant solution to this.

 
Sat May 2 12:25:15 2020   by   Torben
Your problem is probably that the accumulate expression also includes the last roll (that did not fulfil the condition).  But you can filter that out afterwards:

mark := d10;
mark + sum (mark > accumulate x:=d10 while x<mark)


So, you first find the mark.  Then you accumulate dice until you get a result that is greater than or equal to the mark.  Then, you keep only those that are less than the mark (thereby removing the last rolled die), and add these to the mark.

When calculating the probabilities with Troll, set the iteration bound to 99, as the chance of rolling more than the default bound of 12 is quite high when the mark is high.
 
Sun May 3 07:42:21 2020   by   morethanpixels
Yep, that's one of my problems (smile). In your kind response, though, there's a piece missing. On subsequent rolls, whenever (X < mark), X also becomes the new mark. So, for a D4, there's an absolute limit of four rolls.

I meant to make that more clear in the code comments, but I did include it in the "loop" with the second "assign CR to mark".
 
Sun May 3 11:13:52 2020   by   Torben
In that case, you need a function:

call implode(d10)

function implode(x) =
  y := d10;
  if y<x then x+implode(y) else x
 
Sun May 3 21:53:48 2020   by   morethanpixels
Success (after adding the Call within the function). Is this in the approval queue for user-contributed rolls?

"Welsh Piper's imploding dice"


function implode(x) =
  y := sum d10;
  if y<x then x+call implode(y) else x
call implode(sum d10)

\\ Inspiration from https://welshpiper.com/imploding-dice
\\ Code by Torben

\\ After implosion the average result is around 1.3-1.5 times the normal average
\\ Replace "d10" with single or multiple dice as desired
\\ Within Troll, limit a single die to d50 or lower

\\ With a single die (at least d3), the chance of getting a 2 or 3 is always the same; with multiple dice, the distribution is "bumpy" in the middle
 
Mon May 4 09:00:26 2020   by   Torben
Sure, you can put it there if you want.
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list