I would like to calculate the probability that a character will pass a skill test. In this game, a skill test is done as follows:
Three times a player has to dice a 20-sided dice (1-20) and will try to undercut attributes of his/her character (also between 1 and 20). For each of the three values, the difference between the cube value and the attribute value is noted, only if it is positive, otherwise 0 is noted. The test succeeds if the sum of these totalled differences is less than or equal to the skill value of the character. In addition, the test always succeeds if the play get a "1" two or three times ; the test always fails if they get a 20 two or three times.
Example:
Notation: (character attributes) skill value (dice values)
(16,13,8) 5 (1,17,10) -> Not passed
(16,13,8) 5 (1,17,9) -> Passed
So what I am trying to calculate is the probability for a successful skill test BEFORE the player dices.
Example:
I know the probability for a successful skill test if your the character attributes are (16,13,8) and the skill value is 5 will be 0.518625 (thanks to http://simia.net/dsa4wk/).
Is there anyway to create a general formula out of this?
The total number of possible combination will be 8000 (20^3). So something like ((16*13*8)+ something)/8000?
Any help is greatly appreciated :)
Let me show you how this question can be approached. I will not reach the final solution since it is very tedious, however, doing so should be fairly straightforward by following my method.
I will use your notation of (character attributes) skill value (dice values). I assume that we do not know the character attributes a priori, i.e. they are also uniformly allocated. I am not sure if this is the right interpretation of your problem, but I am solving a more difficult case which can be adapted to the situation when the attributes are known a priori.
We can parametrise by setting (A, B, C)d(X,Y,Z), where $d \geq 0$ is a real number, and A,B,C,X,Y,Z ~ Uniform$(1,20)$ on natural numbers, all mutually independent. This is, the character attributes and dice values follow a discrete uniform distribution on {1,...,20}.
The solution to the problem is given by the following probability distribution:
$\mathbb{P} \left(\max\{X-A,0\} + \max\{Y-B,0\} + \max\{Z-C,0\} \leq d \right)$
To find it we need to employ three steps:
1) Find $\mathbb{P}(X-A\leq k)$, where X, A ~ Uniform$(1,20)$ and independent, and $k \in \mathbb{N}$.
To this end, we can write:
$\mathbb{P}(X-A=k)=\sum\limits_{y=1}^{20} \mathbb{P}(X=k+y, \ A = y) = \sum\limits_{y=1}^{20} \mathbb{P}(X=k+y \ \vert \ A = y) \mathbb{P}(A=y) = \sum\limits_{y=1}^{20} \mathbb{P}(X=k+y) \mathbb{P}(A=y) = \frac{1}{20} \sum\limits_{y=1}^{20} \mathbb{P}(X=k+y)$
The last equality is a result of the independence of X and A and in our case $\mathbb{P}(A=y) = \frac{1}{20}$ for all y.
$\sum\limits_{y=1}^{20} \mathbb{P}(X=k+y) = \begin{cases} 0 & \text{for } k \leq -20 \ \text{and} \ k \geq 20 \\ 1+\frac{k}{20} & \text{for } -19 \leq k \leq 0 \\ 1-\frac{k}{20} & \text{for } 0 < k \leq 19 \end{cases}$
Hence, the probability mass function of $X-A$ will be as follows:
$\mathbb{P}(X-A=k)= \begin{cases} 0 & \text{for } k \leq -20 \ \text{and} \ k \geq 20 \\ \frac{1}{20}+\frac{k}{400} & \text{for } -19 \leq k \leq 0 \\ \frac{1}{20}-\frac{k}{400} & \text{for } 0 < k \leq 19 \end{cases}$
We can use this to find the cumulative distribution of $X-A$:
$\mathbb{P}(X-A \leq k)= \sum\limits_{n = -\infty}^{k}\mathbb{P}(X-A=n)= \begin{cases} 0 & \text{for } k \leq -20 \\ \frac{(k+19)^2}{722} & \text{for } -19 \leq k \leq 0 \\ 1-\frac{(k-19)^2}{722} & \text{for } 0 \leq k \leq 19 \\ 1 & \text{for } k \geq 20 \end{cases}$
2) The next step is to find the distribution of $\max\{X-A,0\}$, where X, A ~ Uniform$(1,20)$ and independent.
To this end we can write, by the law of total probability, for $k \in \mathbb{N}$:
$\mathbb{P}(\max\{X-A,0\}\leq k) = \mathbb{P}(\max\{X-A,0\}\leq k \ \vert \ X-A < 0) \ \mathbb{P}(X-A<0) + \mathbb{P}(\max\{X-A,0\}\leq k \ \vert \ X-A \geq 0) \ \mathbb{P}(X-A \geq 0) = \mathbb{P}(X-A<0) \ + \frac{\mathbb{P}(0 \leq X-A \leq k)}{\mathbb{P}(X-A \geq 0)} \ \mathbb{P}(X-A \geq 0) = \mathbb{P}(X-A<0) + \mathbb{P}(0 \leq X-A\leq k) = \mathbb{P}(X-A\leq k) $
Now, utilising the formula from 1) we can write:
$\mathbb{P}(\max\{X-A,0\}\leq k) = \begin{cases} 0 & \text{for} \ k \leq -1 \\ 1-\frac{(k-19)^2}{722} & \text{for } 0 \leq k \leq 19 \\ 1 & \text{for } k \geq 20 \end{cases}$
From this, we can find the probability mass function, which is: $\mathbb{P}(\max\{X-A,0\}= k) = \mathbb{P}(\max\{X-A,0\} \leq k) - \mathbb{P}(\max\{X-A,0\}\leq k -1) = \begin{cases} 0 & \text{for} \ k \leq -1 \ \text{and} \ k \geq 20 \\ \frac{1}{2} & \text{for} \ k = 0 \\ \frac{39-2k}{722} & \text{for } 1 \leq k \leq 19 \\ \end{cases} $
3) Find the distribution of $\max\{X-A,0\}$ + $\max\{Y-B,0\}$, where X,A,Y,B are all discrete uniform on {1,...,20} and mutually independent.
To this end, denote $M = \max\{X-A,0\}$ and $N = \max\{Y-B,0\}$, then using the same trick as in 1), for $k \in \mathbb{N}$:
$\mathbb{P}(M+N \leq k) = \sum\limits_{y=0}^{19}\mathbb{P}(M\leq k-y, N=y) = \sum\limits_{y=0}^{19}\mathbb{P}(M\leq k-y \ \vert \ N=y)\mathbb{P}(N=y) = \sum\limits_{y=0}^{19}\mathbb{P}(M\leq k-y)\mathbb{P}(N=y) = \frac{1}{2}\mathbb{P}(M\leq k) + \frac{1}{722}\left(39\sum\limits_{y=0}^{19}\mathbb{P}(M\leq k-y) - \sum\limits_{y=0}^{19}y\mathbb{P}(M\leq k-y)\right) $
Now, two things remain to be done. Firstly, computing the sums (there will be a few cases to consider) and secondly, applying the third step once again, to the result from 3 and to another max. This will allow to compute the closed form of the final distribution.
A simpler solution to problems like this is to simulate them, though. Below you can see the desired probability distribution, as a result of a simulation.