Dice Combination | Proportion |
---|---|
14, 13, 12, 11, 10, 9 | 0.0015 |
16, 15, 14, 13, 12, 11 | 0.0015 |
15, 14, 13, 12, 10, 9 | 0.0014 |
16, 15, 14, 13, 11, 10 | 0.0014 |
14, 13, 13, 12, 11, 10 | 0.0013 |
15, 14, 13, 12, 12, 11 | 0.0013 |
13, 13, 12, 11, 11, 10 | 0.0012 |
14, 14, 13, 13, 12, 11 | 0.0012 |
15, 14, 13, 12, 11, 10 | 0.0012 |
15, 14, 13, 12, 11, 9 | 0.0012 |
16, 13, 12, 11, 10, 9 | 0.0012 |
16, 14, 13, 12, 11, 10 | 0.0012 |
14, 13, 12, 12, 9, 8 | 0.0011 |
15, 13, 12, 12, 11, 10 | 0.0011 |
15, 14, 13, 12, 11, 7 | 0.0011 |
15, 14, 14, 13, 12, 11 | 0.0011 |
16, 14, 13, 12, 11, 8 | 0.0011 |
16, 14, 13, 12, 11, 9 | 0.0011 |
16, 15, 13, 13, 12, 11 | 0.0011 |
14, 13, 12, 11, 10, 8 | 0.0010 |
Last active
August 29, 2015 14:14
-
-
Save bearloga/7d158dbf02ec027d2b04 to your computer and use it in GitHub Desktop.
During the character creation process in Dungeons & Dragons (D&D), if one chooses to roll for their attributes (dexterity, charisma, constitution, wisdom, intelligence, strength), they must roll 4 6-sided dice 6 times, each time taking the total of the top three dice with the highest outcomes. This is a simulation study (N=10,000) using R of dis…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magrittr) # install.packages('magrittr') | |
library(knitr) # install.packages('knitr') | |
n.sims <- 1e4 | |
set.seed(0) | |
distrs <- replicate(n.sims, | |
replicate(6,sample(1:6,4,repl=T) %>% { sort(.,decreasing=T)[1:3] } %>% sum )) %>% | |
matrix(ncol=6,nrow=n.sims,byrow=T) %>% apply(1,. %>% sort(decreasing=T)) %>% t | |
# Plot | |
distrs %>% as.vector %>% { table(.)/(n.sims*6) } %>% | |
{ x <- barplot(.,main="Distribution of Attribute Rolls",xlab="Total of Top Three Dice",ylab="Proportion",col="cornflowerblue",border="white",ylim=c(0,0.15)); | |
cbind(x,.) } %>% { text(.[,1],.[,2],labels=round(.[,2],3),pos=3,cex=0.75,col="cornflowerblue") } | |
# Table | |
apply(distrs,1,paste,collapse=", ") %>% | |
{ table(.)/n.sims } %>% sort(decreasing=T) %>% head(20) %>% | |
as.data.frame %>% { names(.) <- 'Proportion'; . } %>% kable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment