I am trying to figure out how likely it is to roll a certain combination of 6 ability scores in Dungeons and Dragons.
edit:
Dungeons and Dragons is a tabletop role-playing game. You create a character in a fantasy world which has 6 main statistics, Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma. Those ability scores determine the powers that a certain character can use and how strong they are.
The ability scores are rolled using 4 6-sided dice (4d6) and then using the 3 highest scores, giving you values $\in [3, 18]$ for the possible values.
My goal is to compute the likelihood of getting a combination like (8, 8, 8, 8, 8, 8) or (15, 14, 13, 12, 10, 8).
/edit
I already worked out the probabilities for rolling a single stat and a question on here confirmed that I did the math right:
3: $\frac{1}{1296}$, 4: $\frac{4}{1296}$, 5: $\frac{10}{1296}$, 6: $\frac{21}{1296}$, 7: $\frac{38}{1296}$, 8: $\frac{62}{1296}$, 9: $\frac{91}{1296}$, 10: $\frac{122}{1296}$, 11: $\frac{148}{1296}$, 12: $\frac{167}{1296}$, 13: $\frac{172}{1296}$, 14: $\frac{160}{1296}$, 15: $\frac{131}{1296}$, 16: $\frac{94}{1296}$, 17: $\frac{54}{1296}$, 18: $\frac{21}{1296}$
Now using the same reasoning I managed to work out the probabilities of combinations based on the sum of ability scores, but only if the outcomes are equally likely. I used Python to compute the probabilities like this:
def probability_of_outcomes(outcomes, repetitions, subsum=slice(None, None, None)):
probability_dict = {}
sum_combinations = 0
for c in combinations_with_replacement(outcomes, repetitions):
for p in set(permutations(c, repetitions)):
s = sum(sorted(p)[subsum])
if s in probability_dict:
probability_dict[s] += 1
else:
probability_dict[s] = 1
sum_combinations += 1
return probability_dict, sum_combinations
if __name__ == "__main__":
all_comb, num_combinations_stats = probability_of_outcomes(range(1, 7) 4, subsum=slice(1, None, None))
in the same way I can compute:
abilities_comb, num_combinations_ability = probability_of_outcomes(range(3, 19) 6)
Now with the first computation I can already see that not every number is equally likely, but I am unsure where to add that probability in. Also the approach is not very elegant, as I simply try out every possible combination.
Any ideas?
subsum. But when there is None specified, the code just takes all results (which is for the second call). – meetaig Oct 02 '18 at 11:37