In the game King of Tokyo players get to roll six dice three times. After each roll a player may keep whichever dice they want and reroll the remaining dice. This results in a very large probability tree which would be extremelly difficult to solve by hand. Therefore we are going to use markov chains to find the probilites of obtaining the dice we want after three rolls.
These probabilities assume the player is trying to roll as many of type of number/picture as possible and re-rolling all other dice.
The probabilties of x amount of our desired number/picture rolling n amount of dice are as follows:
SixDice <- numeric()
SixDice[1] <- (5/6)^6
SixDice[2] <- choose(6,1)*(1/6)*(5/6)^5
SixDice[3] <- choose(6,2)*(1/6)^2*(5/6)^4
SixDice[4] <- choose(6,3)*(1/6)^3*(5/6)^3
SixDice[5] <- choose(6,4)*(1/6)^4*(5/6)^2
SixDice[6] <- choose(6,5)*(1/6)^5*(5/6)
SixDice[7] <- choose(6,6)*(1/6)^6
print(SixDice)
## [1] 3.348980e-01 4.018776e-01 2.009388e-01 5.358368e-02 8.037551e-03
## [6] 6.430041e-04 2.143347e-05
FiveDice <- numeric()
FiveDice[1] <- (5/6)^5
FiveDice[2] <- choose(5,1)*(1/6)*(5/6)^4
FiveDice[3] <- choose(5,2)*(1/6)^2*(5/6)^3
FiveDice[4] <- choose(5,3)*(1/6)^3*(5/6)^2
FiveDice[5] <- choose(5,4)*(1/6)^4*(5/6)
FiveDice[6] <- choose(5,5)*(1/6)^5
print(FiveDice)
## [1] 0.4018775720 0.4018775720 0.1607510288 0.0321502058 0.0032150206
## [6] 0.0001286008
FourDice <- numeric()
FourDice[1] <- (5/6)^4
FourDice[2] <- choose(4,1)*(1/6)*(5/6)^3
FourDice[3] <- choose(4,2)*(1/6)^2*(5/6)^2
FourDice[4] <- choose(4,3)*(1/6)^3*(5/6)
FourDice[5] <- choose(4,4)*(1/6)^4
print(FourDice)
## [1] 0.4822530864 0.3858024691 0.1157407407 0.0154320988 0.0007716049
ThreeDice <- numeric()
ThreeDice[1] <- (5/6)^3
ThreeDice[2] <- choose(3,1)*(1/6)*(5/6)^2
ThreeDice[3] <- choose(3,2)*(1/6)^2*(5/6)
ThreeDice[4] <- choose(3,3)*(1/6)^3
print(ThreeDice)
## [1] 0.57870370 0.34722222 0.06944444 0.00462963
TwoDice <- numeric()
TwoDice[1] <- choose(2,0)*(5/6)^2
TwoDice[2] <- choose(2,1)*(1/6)*(5/6)
TwoDice[3] <- (1/6)^2
print(TwoDice)
## [1] 0.69444444 0.27777778 0.02777778
OneDie <- numeric()
OneDie[1] <- 5/6
OneDie[2] <- 1/6
print(OneDie)
## [1] 0.8333333 0.1666667
Using these six vectors we can construct a transition matrix to perform a markov chain analysis.
TM <- matrix(nrow = 7, ncol = 7)
TM[1,1:7] <- SixDice
TM[2,2:7] <- FiveDice
TM[3,3:7] <- FourDice
TM[4,4:7] <- ThreeDice
TM[5,5:7] <- TwoDice
TM[6,6:7] <- OneDie
replace <- is.na(TM)
TM[,][replace] <- 0
print(TM)
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0.334898 0.4018776 0.2009388 0.05358368 0.008037551 0.0006430041
## [2,] 0.000000 0.4018776 0.4018776 0.16075103 0.032150206 0.0032150206
## [3,] 0.000000 0.0000000 0.4822531 0.38580247 0.115740741 0.0154320988
## [4,] 0.000000 0.0000000 0.0000000 0.57870370 0.347222222 0.0694444444
## [5,] 0.000000 0.0000000 0.0000000 0.00000000 0.694444444 0.2777777778
## [6,] 0.000000 0.0000000 0.0000000 0.00000000 0.000000000 0.8333333333
## [7,] 0.000000 0.0000000 0.0000000 0.00000000 0.000000000 0.0000000000
## [,7]
## [1,] 2.143347e-05
## [2,] 1.286008e-04
## [3,] 7.716049e-04
## [4,] 4.629630e-03
## [5,] 2.777778e-02
## [6,] 1.666667e-01
## [7,] 0.000000e+00
The first row of our transition matrix represents the probabilites of obtaining a number x of the dice we want when we havenโt rolled any of the number/picture we want. The second row repesent the probabilities of obtaining x dice when we have exactly one of the die we want and so on.
Next we set our our probablility vector. We note that if we want to examine the behavior of the chain under the assumption that it starts in a certain state si, we simply choose u to be the probability vector with ith entry equal to 1 and all other entries equal to 0:
u <- c(1,0,0,0,0,0,0)
Using the markov formula u(n) = u(P^n) where P is the transition matrix, u is the probability vector and n is the number of steps. Since we get to roll the dice 3 times in king of tokyo we will set n = 3.
P3 <- TM %*% TM %*% TM
U3 <- u * P3
FinalProbs <- U3[1,1:7]
print(FinalProbs)
## [1] 0.037561037 0.164066609 0.298601228 0.289842258 0.158253873 0.046083528
## [7] 0.004777624
Exact probabilites of obtaining x amount of our desired number/picture after three rolls:
None: 3.76% One: 16.41% Two: 29.86% Three: 28.98% Four: 15.83% Five: 4.61% Six: 0.478%