• 0

Dice Game

Question

Posted · Report post

Two students play a game based on the total roll of two standard dice. Student A says that a 12 will be rolled first. Student B says that two consecutive 7s will be rolled first. The students keep rolling until one of them wins. What is the probability that A will win?

0

Share this post


Link to post
Share on other sites

15 answers to this question

  • 0

Posted · Report post

Who so ever starts 1st wins with a Probability of 36/71

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

71/107?

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

13/49

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

All good guesses but not quite. Dark Magician is closest.

0

Share this post


Link to post
Share on other sites
  • 1

Posted · Report post

Whoops! I overlooked the word "consecutive".

~.5386

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

37/72

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

37/72

Closer but Superprismatic was more exact.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Use This simulaton on your microsoft office macro and you will get p = 1/2 as the answer

Use This code in your microsoft office 2010 and you will get p = 1/2

Sub DiceGameTest()
Randomize
Dim NewValue1 As Single
Dim NewValue2 As Single
Dim LastValue1 As Single
Dim LastValue2 As Single
Dim StudentAwin As Single
Dim StudentBwin As Single
Dim Winner As Single

For i = 1 To 5000000
   LastValue1 = 0
   LastValue2 = 0
   Winner = 0
   While Winner = 0
      LastValue1 = NewValue1
      LastValue2 = NewValue2
      NewValue1 = Int((6 * Rnd) + 1)
      NewValue2 = Int((6 * Rnd) + 1)
      If NewValue1 = 6 And NewValue2 = 6 Then Winner = 1
      If NewValue1 + NewValue2 = 7 And LastValue1 + LastValue2 = 7 Then Winner = 2
   Wend
   If Winner = 1 Then StudentAwin = StudentAwin + 1
   If Winner = 2 Then StudentBwin = StudentBwin + 1
   Winner = 0
Next i
total = StudentBwin + StudentAwin
Selection.TypeText Text:=str(StudentAwin / total)
End Sub

 

 

0

Share this post


Link to post
Share on other sites
  • 1

Posted · Report post

I have found two ways to solve this problem analytically - the first not so rigorous and the second more rigorous.  

First method: Let A be the event student A rolls a twelve which has a probability of 1/36.  Then the expected number of rolls for A to roll a 12 is 36 which can easily be calculated from the following equation:  

(1) E(A trials) = 1/36 + 35/36*[ E(A trials)+1]   solving this equation leads to E(A trials)=36.  in general if the probability per trial is p the expected number of trials till success is 1/p.

For B the calculation is a little more complicated:

(2) E(B trials) = 1/6*[1/6 * 2 + 5/6 * (E(B trials) + 2)] + 5/6* [E(B trials)+1] solving this equation leads to E(B trials) = 42.

Now comes the non-rigorous part - effectively the expected value of B rolling consecutive 7's being equal to 42 rolls corresponds to a 1/42 chance on each roll even though this does not correspond to the actual B events (for example B can't win on the first roll).  So using these relative probabilities in a standard way:

P(A) = 1/36

P(B) = 1/42

P(A)/[P(A)+P(B)] = 7/13 probability A wins before B wins.  This is the correct answer 0.538461 as the simulations confirm.

 

Now for the more rigorous way.  Essentially this a  Markov chain analysis (For reference see P. 364 Introduction to Probability - Bertsekas, Tsitsiklis).  There are 4 states in the  chain - two are absorbing -  one where A wins I will call a12, the other where B wins I will call a77.  The other two states are transient states, the start state which I will denote by as, and the state where the previous roll was a 7, I will denote by a17.  Each variable (as, a17, a77, a12)  represents the probability of ending in the final state where A wins (i.e. a roll of 12 before two consecutive 7's) given that they are starting in the current state represented by the variable.  The following equations apply:

a12 = 1

a77 =0

a17 = 29/36 * as + 6/36 * a77 + 1/36 * a12

as = 6/36 * a17 + 29/36 * as + 1/36 * a12

 

Solving these equations leads to as = 7/13.

 

 

0

Share this post


Link to post
Share on other sites
  • 1

Posted · Report post

Here is a png image of the Markov chain for my post above.

MarkovChain.png

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

If anyone understand a bit VBA programming, please check my code, wheather there are some mistake there.

What I do at the simulation is generating random number (1 to 6) twice in each turn, 
Let say dice1 = value1 and dice 2 = value2 than

if value1 = 6 and value2 = 6 then Student A win  (6+6 = 12)
if value1 + value2 = 7 and lastValue1 + lastValue2 = 7 then student B win
if no winner, I repeat until the winner found.

After the winner found, I repeat all the game again 5 million times
After 5 million times I compare student A winning times with student B winning times,
And I find both student have equal chance to win

It take about 10 to 15 second for my computer to do this simulation.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

3 times running the simulation, and I get this result :

 0.4985224
 0.4985202
 0.4985316

Even it seems student B winning chance is a bit bigger than student A

 

0

Share this post


Link to post
Share on other sites
  • 1

Posted · Report post

If anyone understand a bit VBA programming, please check my code, wheather there are some mistake there.

What I do at the simulation is generating random number (1 to 6) twice in each turn, 
Let say dice1 = value1 and dice 2 = value2 than

if value1 = 6 and value2 = 6 then Student A win  (6+6 = 12)
if value1 + value2 = 7 and lastValue1 + lastValue2 = 7 then student B win
if no winner, I repeat until the winner found.

After the winner found, I repeat all the game again 5 million times
After 5 million times I compare student A winning times with student B winning times,
And I find both student have equal chance to win

It take about 10 to 15 second for my computer to do this simulation.

I'm not familiar with VBA. But your code from above this post looks familiar enough to me (I use Python), that I think I know where you went wrong.

It doesn't look iike you allow for a roll where player 1 can win and player 2 can't (the first roll). 

Your procedure for a game should be this:

1. Roll two dice. If they total 12, player 1 wins and end

2. If not, store the roll in "last roll", then enter loop.

Loop:

3. Each iteration of loop, roll two dice,  if they total 12 player 1 wins or if (they total 12 AND "last roll" was 7), player 2 wins.

4. If 3 didn't terminate the loop, store the current roll in last roll, and go back to 3 until you get a winner. 

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

It doesn't look iike you allow for a roll where player 1 can win and player 2 can't (the first roll). 

Your procedure for a game should be this:

While Winner = 0
      LastValue1 = NewValue1   
      LastValue2 = NewValue2
      NewValue1 = Int((6 * Rnd) + 1)
      NewValue2 = Int((6 * Rnd) + 1)
      If NewValue1 = 6 And NewValue2 = 6 Then Winner = 1
      If NewValue1 + NewValue2 = 7 And LastValue1 + LastValue2 = 7 Then Winner = 2
   Wend

I have checked back my code, and I think nothing wrong there. Student A still can win even at first roll.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

It doesn't look iike you allow for a roll where player 1 can win and player 2 can't (the first roll). 

Your procedure for a game should be this:

While Winner = 0
      LastValue1 = NewValue1   
      LastValue2 = NewValue2
      NewValue1 = Int((6 * Rnd) + 1)
      NewValue2 = Int((6 * Rnd) + 1)
      If NewValue1 = 6 And NewValue2 = 6 Then Winner = 1
      If NewValue1 + NewValue2 = 7 And LastValue1 + LastValue2 = 7 Then Winner = 2
   Wend

I have checked back my code, and I think nothing wrong there. Student A still can win even at first roll.

In your code, can student B win on the first roll? I don't know VBA, but if you try this:

While Winner = 0
      NewValue1 = Int((6 * Rnd) + 1)
      NewValue2 = Int((6 * Rnd) + 1)
      If NewValue1 = 6 And NewValue2 = 6 Then Winner = 1
      If NewValue1 + NewValue2 = 7 And LastValue1 + LastValue2 = 7 Then Winner = 2

      LastValue1 = NewValue1   
      LastValue2 = NewValue2
   Wend 

Do you get a different result?

markweitzman above, derived a rigorous Markov chain proof of the correct answer. If your code is not getting the same answer there must be something wrong.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.