Simulate Rolls from non-transitive Grime dice. http://bayesianbiologist.com/2013/04/07/a-quick-guide-to-non-transitive-grime-dice/
## Simulate Grime Dice ## | |
red<-c(4,4,4,4,4,9) | |
blue<-c(2,2,2,7,7,7) | |
olive<-c(0,5,5,5,5,5) | |
yellow<-c(3,3,3,3,8,8) | |
magenta<-c(1,1,6,6,6,6) | |
## Play n match-ups between d1 and d2 | |
## Return the proportion of d1 victories | |
roll_dice<-function(d1,d2,n=1) | |
{ | |
d1rolls<-sample(d1,n,replace=T) | |
d2rolls<-sample(d2,n,replace=T) | |
return(mean(d1rolls > d2rolls)) | |
} | |
# Single Roll | |
roll_dice(red,blue) | |
# Average wins | |
roll_dice(red,blue,n=1000000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment