Como posso calcular a probabilidade de sucesso completo com esse conjunto de dados mistos usando o AnyDice?

1

I've playing around with dice probabilities and have a spreadsheet that handles the calculation for basic probabilities rolling a set of dice and counting the number of successes. I am completely new to using any dice and have been reading the documentation and examples, but need help in figuring out to solve my problem. Any advice is much appreciated!

Here's what I'm trying to figure out: When rolling a pool of 4d6 a 5 or 6 is a success. Two of the dice need to be a five or a six to be a full success. The probability is roughly 41% of getting a full success. I figured that out with math.

Now to the more complicated scenario. Same rules as above except replace a d6 for a d8 and a result of 8 on that die counts as 2 successes a roll of 6 or 7 counts as one success. I am looking for the probability of complete success (two or more successes). So roll 3d6 and 1d8 looking for the probability of complete success.

aqui estão alguns exemplos:

  • 3d6 and 1d8 -> 2,4,2 and 3 -> No successes
  • 3d6 and 1d8 -> 3, 6, 5 and 4 -> Two successes condition met
  • 3d6 and 1d8 -> 3, 4, 5 and 6 -> Two successes condition met
  • 3d6 and 1d8 -> 1, 1, 3 and 8 -> 8 roll counts for two successes condition met
  • 3d6 and 1d8 -> 4, 5, 2 and 5 -> One success condition not met (only 6 and 7 on the d8 count as success)
  • 3d6 and 1d8 -> 5, 5, 2 and 8 -> Four successes condition met.
  • 3d6 and 1d8 -> 4, 4, 2 and 7 -> One success condition not met.

Is this possible with AnyDice?

por ReadyPlayerOne 06.07.2019 / 22:34

1 resposta

In programming, there are often as many correct ways to solve a problem, as there are programmers. Sometimes even more. The best way to learn a tool is to read code, so here are three ways of solving your problem, showcasing the possibilities of anydice.

Variante 1

When trying to inspect the all results of a die roll separately in anydice, it's often easiest to do so in a function which takes a number as a parameter, and pass it the die roll as an argument. So:

function: successes EIGHT:n { ... }

output [successes 1d8]

Next, it's only a matter of checking for favorable cases and keeping count:

SUCCESSES: 0
if EIGHT >= 6 { SUCCESSES: SUCCESSES + 1 }
if EIGHT >= 8 { SUCCESSES: SUCCESSES + 1 }

If we put it all together, it might look like this:

function: successes A:n B:n C:n EIGHT:n {
    S: 0
    if EIGHT >= 6 { S: S + 1 }
    if EIGHT >= 8 { S: S + 1 }
    if A >= 5 { S: S + 1 }
    if B >= 5 { S: S + 1 }
    if C >= 5 { S: S + 1 }
    result: S
}

output [successes 1d6 1d6 1d6 1d8]

Now if we calculate the result and click "At Least", we can see that the probability of at least two successes is 46.3%.

Variante 2

Another option is to simply construct a die that rolls the number of successes with their respective probabilities:

EIGHT: {}
loop N over {1d8} {
    if N >= 8 { EIGHT: { EIGHT , 2 } }
    else if N >= 6 { EIGHT: { EIGHT , 1 } }
    else { EIGHT: { EIGHT , 0 } }
}

SIX: {}
loop N over {1d6} {
    if N >= 5 { SIX: { SIX, 1 } }
    else { SIX: { SIX, 0 } }
}

output 3dSIX + 1dEIGHT

We can then make us of the "At Least" visualization again to arrive at the same result.

Variante 3

Inspired by Variant 2, given that the "successes" die is pretty easy to construct ourselves, we could also just write:

EIGHT: { 0, 0, 0, 0, 0, 1, 1, 2 }
SIX: { 0, 0, 0, 0, 1, 1 }

output 3dSIX + 1dEIGHT
07.07.2019 / 00:19