0

Can't quite wrap my head around how to go about this (outside of brute forcing it with manual calculations, which isn't ideal given variable difficulties and variable numbers of dice) so I figured I'd ask here.

I'm playing in a game where I can spend limited resources at attempts to harvest and create things. This runs on a D6 system.

Difficulty for harvest, and difficulty to craft, can be 2+, 3+, 4+, 5+, 6+, or 6 and then 5+ on a following roll(counts as a "single" roll for cost purposes), average difficulty 4+. Difficulty goes down by 1, minimum 2+, each attempt.

So if I spend the resources to make 2 harvest attempts and up to 2 craft attempts:

Harvest 1: 4+ pass, 3- fail.

Harvest 2: 3+ pass, 2- fail.

Craft 1: 4+ pass, 3- fail. Irrelevant if both harvests fail.

Craft 2: 3+ pass, 2- fail. Irrelevant if both harvests don't pass.

To make things slightly less complicated, I only particularly care if at least 1 craft passes, so I'm trying to balance harvest vs craft to successfully get at least 1 pass.

TLDR: How do I go about calculating the odds of overall success when each attempt on one side regresses in difficulty on that side, down to a minimum, each attempt on the other side regresses difficulty on that side, and the cap on number of attempts on the second side is dependent on the number of successes on the first?

John
  • 1
  • Welcome to RPG.SE! Take the [tour] and visit the [help] if you need any guidance in posting questions&answer! The rules are not completely clear to me, specially this part:
    • how many attempts can you do for harvesting/crafting?
    • if an harvesting/crafting attempt starts with a 6+ difficulty, than does it go down to 5+, 4+, 3+, 2+ and than it rises again to 5+?
    – Eddymage Aug 12 '21 at 07:18
  • 3
    Is the number of harvest attempts decided before you see the result? Do you have to declare "I have 4 currency, I will do 2 harvest attempts and 2 crafting attempts" and then if the harvest attempts fail you simply cannot craft? Or can you decide based on your successes? Can you say "I have 4 currency. I will roll one harvest.. oh it failed, so I will roll another harvest.. oh it failed, I will try to do 1 more harvest and if it succeeds I still have 1 currency left to attempt crafting"? – RHS Aug 12 '21 at 11:51
  • 3
    Also, is your question merely how to compute the probability for a given number of attempts, or how to optimize use of your currency to maximize probability to get at least one successful crafting attempt? – RHS Aug 12 '21 at 13:53
  • 1
    Possibly just for our tagging purposes to help someone else find it, but does this game system have a name or is it purely homebrew? – Someone_Evil Aug 12 '21 at 16:32
  • 1
    I don't think this question should be closed. It is on-topic, and can be objectively answered as @RHS's excellent answer shows. – ADdV Aug 12 '21 at 20:44
  • 3
    @ADdV it is not closed as off topic or subjective. It is closed as needing more details, as there are unanswered requests for clarifications in the first 3 comments. – Mołot Aug 13 '21 at 10:29

2 Answers2

2

I think a certain amount of brute-forcing will be necessary if you want to calculate it exactly.

The probability of having at least one successful crafting \$p(C\ge1)\$ if we have \$n\$ harvest and \$m\$ crafting attempts is:

\$p(C\ge1) = 1 - \displaystyle\sum_i^m p(C=0|H=i,n) p(H=i|n )\$

with

\$p(C=0|H=i,n) = \displaystyle\prod_{j=0}^i (1-p_j) \$

where \$H=i, n\$ means that you had \$i\$ successful harvests from \$n\$ attempts (and thus \$i\$ crafting attempts) and \$p_j\$ is the probability of the \$j\$-th roll. Note thay \$j=0\$ refers to the "zeroth" roll and \$p_0\$ is always 0.

Now, the problem is \$ p(H=i|n)\$. If all rolls had the same probability, this would be a binomial distribution. But since they don't have the same probability, it follows a Poisson binomial distribution, and unfortunately the only way to compute this distribution (without approximating it) is to list all possible outcomes. For example, if \$n = 3\$:

\$p(H=0|n=3) = \displaystyle\prod_{j=1}^n (1-p_j) \$

\$p(H=1|n=3) = p_1 (1-p_2) (1-p_3) + (1-p_1)p_2(1-p_3) + (1-p_1)(1-p_2)p_3\$

\$p(H=2|n=3) = p_1 p_2 (1-p_3) + p_1(1-p_2)p_3 + (1-p_1)p_2p_3\$

\$p(H=3|n=3) = \displaystyle\prod_{j=1}^n p_j \$

There is a closed form for this on Wikipedia, but it really just hides the fact that we are generating all possible combinations with set theory.

Now, if we assume you have the possibility to compute the Poisson Binomial Distribution (e.g. using a software library), then the result would be:

\$p(C\ge1) = 1- \displaystyle\sum_{i=0}^m \left(\displaystyle\prod_j^i (1-p_j)\right) PBD(i,n,p)\$

where \$PBD(i,n,p)\$ is the probability of having i successes from n rolls given the probabilities p. I'm not sure I understood the values for p correctly, but I think it's \$p_j = \min(\frac46, \frac{j}6)\$ if it's 6+ on the first roll and 2+ at the best.

Example

If \$n=2\$ and \$m=2\$ and the probabilities for rolls are \$p=(0, \frac16,\frac26)\$ (so difficulty starting at 6+ and then going down to 5+, the first zero is the probability of succeeding without rolling)

\$PDB(0,2,p) = \frac{20}{36}\$

\$PDB(1,2,p) = \frac{14}{36}\$

\$PDB(2,2,p) = \frac2{36}\$

\$ p(C\ge1) = 1 - (1-p_0)PDB(0,2,p) - (1-p_0)(1-p_1) PDB(1,2,p) - (1-p_0)(1-p_1)(1-p_2)PDB(2,2,p)\$

\$ = 1 - 1\frac{20}{36} - 1\frac56 \frac{14}{36} - 1\frac56\frac46\frac2{36}\ = 0.08950617\$

In your example you used different difficulties, though. You started from 4+ and went down to 3+. In that case the result would be around 0.277

RHS
  • 2,253
  • 9
  • 26
  • I would not call it a brute-force approach, but instead an elegant approach, because it uses Maths. A brute force approach consists in computing all the possible outcomes and their frequency. – Eddymage Aug 12 '21 at 20:17
  • 2
    Yeah, when I have a probability question, it usually ends with me scripting something, running it 10,000,000 times, and saying "yeah, about that." Brute force probability. – Charlie Bamford Aug 12 '21 at 23:12
  • Well, the solution requires computing all possible outcomes and their frequencies for the first half of the game. – RHS Aug 13 '21 at 04:53
  • For me a brute force approach means that, for example, if you have to compute the probabilities of the outcomes for the sum of 2d6 you list (1,1)->2, (1,2)->3, (1,3)->4, ..., (6,5)->11, (6,6)->12 and then you count the occurrences. Great answer, though. – Eddymage Aug 13 '21 at 10:54
  • Yeah ok, the PDB function above doesn't list all possible dice rolls, but it does list all possible combinations of failed and successful rolls. Thanks, anyways! – RHS Aug 13 '21 at 11:36
-1

If my understanding is correct ...

You need to succeed in at least one check in the first pool and at least one check in the second and each check in each pool can have a different probability of success.

Let's call the first pool \$A\$ and you have \$n\$ attempts with a probability of success of \$a_i\$. Similarly, you have \$m\$ attempts in the \$B\$ pool with a probability of success of \$b_i\$. If so, the overall probability of success is:

$$ \begin{align} p&= \left(1-\prod_{i=1}^n(1-a_i)\right)\left(1-\prod_{i=1}^m(1-b_i)\right) \end {align} $$

For your example where \$n=m=2\$ and \$a_1={3\over6}\$, \$a_2={4\over6}\$, \$b_1={3\over6}\$ and \$b_2={4\over6}\$ the answer is:

$$ \begin{align} p&= \left(1-\left(1-{3\over6}\right)\left(1-{4\over6}\right)\right)\left(1-\left(1-{3\over6}\right)\left(1-{4\over6}\right)\right)\\ &={25\over 36} \end {align} $$

Eddymage
  • 28,645
  • 3
  • 76
  • 150
Dale M
  • 210,673
  • 42
  • 528
  • 889
  • If I understand correctly, the number of crafting attempts is dependent on the number of successful harvesting attempts. I don't think you modeled that. – RHS Aug 12 '21 at 11:46
  • @RHS that’s not what the OP wrote. If it is, the maths is much simpler. – Dale M Aug 12 '21 at 12:35
  • Sorry for the back and forth, OP wrote: "and the cap on number of attempts on the second side is dependent on the number of successes on the first" – RHS Aug 12 '21 at 13:54