# Who will win this dice game? [closed]

You are playing a dice game with your friend by rolling two standard dice and recording the sum of the two numbers. You win when two consecutive outcomes are 7. Your friend wins when three consecutive outcomes are in strictly increasing order. You will continue rolling until one of you wins. What is the probability that you will win? And why?

Examples: If the outcomes are 10,4,6,6,7,7 you win. If the outcomes are 7,3,7,9 your friend wins.

## closed as off-topic by f'', BmyGuest, Mike Earnest, Wu33o, GamowJun 22 '16 at 9:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is off-topic as it appears to be a mathematics problem, as opposed to a mathematical puzzle. For more info, see "Are math-textbook-style problems on topic?" on meta." – f'', BmyGuest, Mike Earnest, Wu33o, Gamow
If this question can be reworded to fit the rules in the help center, please edit the question.

• Where's the puzzle in this? – f'' Jun 21 '16 at 21:41
• This looks like a probability question rather than a puzzle. – Glen_b Jun 22 '16 at 7:04

I think Jonathan is pretty darn close, and may even be right. Here's my view though (which gives a slightly different answer).

Basically, you have a Markov chain with 21 possible states:

• Start Position
• First throw in a run is 2
• First throw in a run is 3
• ...
• First throw in a run is 10 (first throw is 11 or 12 is just the starting point)
• Second throw in a run is 3
• Second throw in a run is 4
• ...
• Second throw in a run is 11 (second throw being 12 is also just the starting point)
• 3 in a row achieved
• Two 7s in a row achieved

This has a transition matrix as follows:

$$36\cdot M = \left( \begin{array}{ccccccccccccccccccccc} 3 & 1 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 2 & 0 & 0 \\ 1 & 1 & 2 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 2 & 0 & 0 \\ 1 & 1 & 2 & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 4 & 5 & 6 & 5 & 4 & 3 & 2 & 0 &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 0 & 10 & 0 \\ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 \\ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 3 & 0 \\ 2 & 1 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 36 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 36 \end{array} \right)$$

If you raise this to powers of 2 (essentially setting $M=M\cdot M$), the first row and the last two numbers (which represent the probability of winning and losing after $2^n$ games from a starting position) is as follows (columns are $n$, $p_\mathrm{lose}$, $p_\mathrm{win}$):

$$\begin{array}{rll} 0 & 0.0 & 0.0 \\ 1 & 0.0 & 0.0277777777778 \\ 2 & 0.209010273777 & 0.0722522290809 \\ 3 & 0.497378080381 & 0.129539182343 \\ 4 & 0.725113419221 & 0.174709716474 \\ 5 & 0.802680863178 & 0.19009613874 \\ 6 & 0.808676921282 & 0.191285528049 \\ 7 & 0.808708255435 & 0.19129174355 \\ 8 & 0.808708256282 & 0.191291743718 \\ 9 & 0.808708256282 & 0.191291743718 \\ 10 & 0.808708256282 & 0.191291743718 \end{array}$$

meaning convergence after 256 games, and a probability of 0.1912917.

• This probability is a bit closer (than @JonathanAllan's) to what I get with code. – Dan Russell Jun 21 '16 at 20:30
• @DanRussell - me too. I just ran multiple runs of 100K games and got 19.149% as an average. – TTT Jun 21 '16 at 20:55
• I guess my answer just needs to add the probability of a $7$ winning it for the friend – Jonathan Allan Jun 21 '16 at 21:06
• this one is right, good way to show it, i think it is long but interesting question... – Oray Jun 21 '16 at 21:08
• @Oray, do you have a simpler way to see it? I always love doing Markov chains, which I think are quite elegant ways of seeing the solution. I'm amazed by how close Jonathan Allan's solution was! Nice puzzle, btw – Dr Xorile Jun 21 '16 at 21:54

I think you will win

$\frac7{36}$ of games in expectation

Because (I hope this logic holds)

If a roll sums to $7$ and does not win the game for either of you then you have a $\frac16$ chance of winning with the next roll. If the second roll is a $7$ your friend has not won, but $\frac16$ of the time this happens you have won. $\frac16\frac16+\frac16=\frac7{36}$

• What about rolls where they never add to 7? I think to do this you might need to figure out the probability of victory starting at every possible sum and add them – Moose Jun 21 '16 at 19:49
• Either your friend has already won or there may be a $7$ which does not win the game for them. – Jonathan Allan Jun 21 '16 at 19:51
• A good try and surprisingly close to the right answer, but you're ignoring the possibility of the previous roll being 7 and the fact that the different possible rolls are not independent since your losing or winning and your opponent losing or wining are not directly related, as they would be if you needed two sevens in a row and he needed a seven then an eight for example. – P... Jun 21 '16 at 20:24

I tested this with code and ended up with right around what Jonathan Allan suggests in his answer. I simulated a million games a few times, and the results are:

You won 19.07%, 19.15%, 19.14% of the games.

That's assuming my (python2.7) code is correct, of course.

import random

def roll():
return random.choice([2,3,3,4,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,9,9,9,9,10,10,10,11,11,12])

def game():
count = 0
rolls = []
while True:
rolls.append(roll())
if count >= 1:
if (rolls[count] == 7) and (rolls[count-1] == 7):
winner = "A"
break
if count >= 2:
if (rolls[count] > rolls[count-1]) and (rolls[count-1] > rolls[count-2]):
winner = "B"
break
count += 1
#    print "Winner: %s" % winner
#    print rolls
return winner

def games(n):
game_number = 1
count_a = 0
count_b = 0
while game_number <= n:
result = game()
if result == "A":
count_a += 1
if result == "B":
count_b += 1
game_number += 1
print "A won %i and B won %i of %i total." % (count_a,count_b,game_number-1)
print "A won %s percent of the games." %(str(100*float(count_a)/(game_number-1)))


This isn't intended to be the answer, just posting this for those who want to give it a try.

You will win

approximately 19.1% of the time. I wasn't in the mood to think so I just coded it instead.

I barely tested but it does seem to be close to Jonathan Allan's answer, since 7/36 = 19.44%, and also Dr Xorile's answer of 19.12...

Can't resist writing an R solution:

library(pbapply) # progress bar in replicate
simul <- function()
{
won1 <- FALSE # I won, if 7-7
won2 <- FALSE # friend won, if 1<2<3
vals <- sample(1:6,1)+sample(1:6,1)
while(!won1 & !won2)
{
vals <- c(vals, sample(1:6,1)+sample(1:6,1) )
if(all(tail(vals,2)==7)) won1 <- TRUE
n <- length(vals)
if(n==2) next
if(vals[n-2] < vals[n-1] & vals[n-1] < vals[n]) won2 <- TRUE
}
# return output:
won1
}

res <- pbreplicate(1e3, mean(replicate(1e3, simul())))
hist(res, col=4, breaks=50)
mean(res) # 0.1904


1000 repetitions of 1000 games show this distribution: