Skip to content

Instantly share code, notes, and snippets.

@saralilyb
Created April 26, 2016 13:18
Show Gist options
  • Save saralilyb/ca39c8395a9a9b4e4a0e183396e838d9 to your computer and use it in GitHub Desktop.
Save saralilyb/ca39c8395a9a9b4e4a0e183396e838d9 to your computer and use it in GitHub Desktop.
MCMC model of dice rolling: is a bastard sword better than a longsword (2nd Ed, BGII)
# 2d4 vs 1d8
samples <- 10000
# 2d4
m1d4 <- sample(1:4, samples, replace = TRUE)
m2d4 <- sample(1:4, samples, replace = TRUE)
bastard_sword <- m1d4 + m2d4
# 1d8
m1d8 <- sample(1:8, samples, replace = TRUE)
longsword <- m1d8
summary(bastard_sword)
summary(longsword)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment