New here.
I'm trying to figure out how to come up with a roll system for a game, where i want the probability of rolling N dice or rolling one dice N times and then taking the two largest outcomes, adding them together and equaling them to some value.
I'd be happy if someone could help me with either a formula, pseudocode or the likes.
Thanks.
I already tried something with binomials etc., but i'm confused about the math.
Expected result of running the aforementioned example: 70.4%
EDIT: I might have formulated the question wrong. Instead of rolling two dies 14 times and finding the sum of the larger two equaling 12, i'd like to e.g. find the sum of the two larger dice in a roll with 14 dice that equal to 8. This might change the answer?
Your example is simple: $$ p=1-\left (\frac56\right)^{14}-\binom {14}1 \left (\frac56\right)^{13}\left (\frac16\right)\approx 0.704.$$
In this expression we have subtracted from $1$ the probabilities of having no or only one 6. The general expression will be much more complicated.
The general expression: $$ p_X=\sum_{k=\max(1,X-K)}^{\min(K,\lfloor\frac X2\rfloor)}\sum_{n=2}^N\binom Nn \left (\frac1K\right)^n \left (\frac{k-1}K\right)^{N-n} n^{1-\delta_{k,\frac X2}}, $$ where $X$ is the sum which probability is to be computed, $K$is the number of dice faces (numbered from $1$ to $K$), $N$ is the number of rolls, $\delta$ is Kronecker delta, $\lfloor x\rfloor$ is the floor function.
Hope this helps.