With even probabilities these are the 88 ways in which results could happen:
0 2 -1 -1 0.25
0 4 -1 1 -1 -1 0.0625
0 6 -1 1 -1 1 -1 -1 0.015625
0* -1 1 -1 1 -1 1 -1 -1 0.00390625
2* -1 1 -1 1 -1 1 -1 1 0.00390625
2* -1 1 -1 1 -1 1 1 -1 0.00390625
4* -1 1 -1 1 -1 1 1 1 0.00390625
0* -1 1 -1 1 1 -1 -1 -1 0.00390625
2* -1 1 -1 1 1 -1 -1 1 0.00390625
2* -1 1 -1 1 1 -1 1 -1 0.00390625
4* -1 1 -1 1 1 -1 1 1 0.00390625
2* -1 1 -1 1 1 1 -1 -1 0.00390625
4* -1 1 -1 1 1 1 -1 1 0.00390625
5 -1 1 -1 1 1 1 1 0.0078125
0 6 -1 1 1 -1 -1 -1 0.015625
0* -1 1 1 -1 -1 1 -1 -1 0.00390625
2* -1 1 1 -1 -1 1 -1 1 0.00390625
2* -1 1 1 -1 -1 1 1 -1 0.00390625
4* -1 1 1 -1 -1 1 1 1 0.00390625
0* -1 1 1 -1 1 -1 -1 -1 0.00390625
2* -1 1 1 -1 1 -1 -1 1 0.00390625
2* -1 1 1 -1 1 -1 1 -1 0.00390625
4* -1 1 1 -1 1 -1 1 1 0.00390625
2* -1 1 1 -1 1 1 -1 -1 0.00390625
4* -1 1 1 -1 1 1 -1 1 0.00390625
5 -1 1 1 -1 1 1 1 0.0078125
0* -1 1 1 1 -1 -1 -1 -1 0.00390625
2* -1 1 1 1 -1 -1 -1 1 0.00390625
2* -1 1 1 1 -1 -1 1 -1 0.00390625
4* -1 1 1 1 -1 -1 1 1 0.00390625
2* -1 1 1 1 -1 1 -1 -1 0.00390625
4* -1 1 1 1 -1 1 -1 1 0.00390625
5 -1 1 1 1 -1 1 1 0.0078125
5 -1 1 1 1 1 0.03125
0 4 1 -1 -1 -1 0.0625
0 6 1 -1 -1 1 -1 -1 0.015625
0* 1 -1 -1 1 -1 1 -1 -1 0.00390625
2* 1 -1 -1 1 -1 1 -1 1 0.00390625
2* 1 -1 -1 1 -1 1 1 -1 0.00390625
4* 1 -1 -1 1 -1 1 1 1 0.00390625
0* 1 -1 -1 1 1 -1 -1 -1 0.00390625
2* 1 -1 -1 1 1 -1 -1 1 0.00390625
2* 1 -1 -1 1 1 -1 1 -1 0.00390625
4* 1 -1 -1 1 1 -1 1 1 0.00390625
2* 1 -1 -1 1 1 1 -1 -1 0.00390625
4* 1 -1 -1 1 1 1 -1 1 0.00390625
5 1 -1 -1 1 1 1 1 0.0078125
0 6 1 -1 1 -1 -1 -1 0.015625
0* 1 -1 1 -1 -1 1 -1 -1 0.00390625
2* 1 -1 1 -1 -1 1 -1 1 0.00390625
2* 1 -1 1 -1 -1 1 1 -1 0.00390625
4* 1 -1 1 -1 -1 1 1 1 0.00390625
0* 1 -1 1 -1 1 -1 -1 -1 0.00390625
2* 1 -1 1 -1 1 -1 -1 1 0.00390625
2* 1 -1 1 -1 1 -1 1 -1 0.00390625
4* 1 -1 1 -1 1 -1 1 1 0.00390625
2* 1 -1 1 -1 1 1 -1 -1 0.00390625
4* 1 -1 1 -1 1 1 -1 1 0.00390625
5 1 -1 1 -1 1 1 1 0.0078125
0* 1 -1 1 1 -1 -1 -1 -1 0.00390625
2* 1 -1 1 1 -1 -1 -1 1 0.00390625
2* 1 -1 1 1 -1 -1 1 -1 0.00390625
4* 1 -1 1 1 -1 -1 1 1 0.00390625
2* 1 -1 1 1 -1 1 -1 -1 0.00390625
4* 1 -1 1 1 -1 1 -1 1 0.00390625
5 1 -1 1 1 -1 1 1 0.0078125
5 1 -1 1 1 1 0.03125
0 6 1 1 -1 -1 -1 -1 0.015625
0* 1 1 -1 -1 -1 1 -1 -1 0.00390625
2* 1 1 -1 -1 -1 1 -1 1 0.00390625
2* 1 1 -1 -1 -1 1 1 -1 0.00390625
4* 1 1 -1 -1 -1 1 1 1 0.00390625
0* 1 1 -1 -1 1 -1 -1 -1 0.00390625
2* 1 1 -1 -1 1 -1 -1 1 0.00390625
2* 1 1 -1 -1 1 -1 1 -1 0.00390625
4* 1 1 -1 -1 1 -1 1 1 0.00390625
2* 1 1 -1 -1 1 1 -1 -1 0.00390625
4* 1 1 -1 -1 1 1 -1 1 0.00390625
5 1 1 -1 -1 1 1 1 0.0078125
0* 1 1 -1 1 -1 -1 -1 -1 0.00390625
2* 1 1 -1 1 -1 -1 -1 1 0.00390625
2* 1 1 -1 1 -1 -1 1 -1 0.00390625
4* 1 1 -1 1 -1 -1 1 1 0.00390625
2* 1 1 -1 1 -1 1 -1 -1 0.00390625
4* 1 1 -1 1 -1 1 -1 1 0.00390625
5 1 1 -1 1 -1 1 1 0.0078125
5 1 1 -1 1 1 0.03125
5 1 1 1 0.125
0.453125 .28125 .265625 1
0 .25 .125 .125 .09375 .078125 .0625 .265625
done
Lines beginning 0 or 5 represent cases where the gambler lost all his money, or he gained the extra $300 to wind up with $500; if this is not followed by an asterisk it was before bet #8. Other digits are followed by a * to indicate 8 bets took place; the digit represents how many hundred the gambler left with, which could be 0 or 5 even though that doesn't satisfy the requirement for event i or ii. The sequence of positive and negative 1's represent the outcome of each play, representing the win or loss in 100's. Finally the line shows the probability of this particular outcome sequence.
Events i, ii and iii have respective probabilities:
0.453125 .28125 .265625
as given above.
The respective probabilities of outcomes of: zero, $500 and stopping because neither has been achieved after 8 bets are:
0.50390625 .28125 .21484375 which do add to 1 as a check.
The probabilities of ending after 1 through 8 bets are respectively:
0 .25 .125 .125 .09375 .078125 .0625 .265625
The difference between the 0.453125 probability of event i, and the 0.50390625 of ending with no money is the result of event i not including going broke on the 8th bet.
With this even probability on each bet, the most likely number of rounds is 8, just barely beating out 2.
DefDbl A-Z
Dim crlf$, probLen(8), probNow, p, resources, hist(8), prob0, prob5, prob8
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
p = 0.5
probNow = 1: resources = 2 ' resources are in hundreds
spinIt 1
Text1.Text = Text1.Text & crlf & prob0 & Str(prob5) & Str(prob8) & " " & Str(prob0 + prob5 + prob8) & crlf
For i = 1 To 8
Text1.Text = Text1.Text & Str(probLen(i)) & " "
Next
Text1.Text = Text1.Text & crlf
Text1.Text = Text1.Text & crlf & " done"
End Sub
Sub spinIt(wh)
For chg = -1 To 1 Step 2
saveProbNow = probNow
If chg = -1 Then probNow = probNow * (1 - p) Else probNow = probNow * p
hist(wh) = chg
resources = resources + chg
If wh = 8 Then
Text1.Text = Text1.Text & resources & "* "
For i = 1 To wh
Text1.Text = Text1.Text & Str(hist(i)) & " "
Next
prob8 = prob8 + probNow
Text1.Text = Text1.Text & probNow & crlf
probLen(wh) = probLen(wh) + probNow
Else
Select Case resources
Case 0
Text1.Text = Text1.Text & resources & " " & wh & " "
For i = 1 To wh
Text1.Text = Text1.Text & Str(hist(i)) & " "
Next
prob0 = prob0 + probNow
Text1.Text = Text1.Text & probNow & crlf
probLen(wh) = probLen(wh) + probNow
Case 5
Text1.Text = Text1.Text & resources & " "
For i = 1 To wh
Text1.Text = Text1.Text & Str(hist(i)) & " "
Next
prob5 = prob5 + probNow
Text1.Text = Text1.Text & probNow & crlf
probLen(wh) = probLen(wh) + probNow
Case Else
spinIt wh + 1
End Select
End If
resources = resources - chg
probNow = saveProbNow
Next chg
End Sub
For the bonus, we just change p = 1 to p = 18/37, and we get:
0 2 -1 -1 0.263696128560993
0 4 -1 1 -1 -1 6.58758772592109E-02
0 6 -1 1 -1 1 -1 -1 1.64569393883493E-02
0* -1 1 -1 1 -1 1 -1 -1 4.11122956231954E-03
2* -1 1 -1 1 -1 1 -1 1 3.89484905903956E-03
2* -1 1 -1 1 -1 1 1 -1 3.89484905903956E-03
4* -1 1 -1 1 -1 1 1 1 3.68985700330064E-03
0* -1 1 -1 1 1 -1 -1 -1 4.11122956231954E-03
2* -1 1 -1 1 1 -1 -1 1 3.89484905903956E-03
2* -1 1 -1 1 1 -1 1 -1 3.89484905903956E-03
4* -1 1 -1 1 1 -1 1 1 3.68985700330064E-03
2* -1 1 -1 1 1 1 -1 -1 3.89484905903956E-03
4* -1 1 -1 1 1 1 -1 1 3.68985700330064E-03
5 -1 1 -1 1 1 1 1 7.18551100642756E-03
0 6 -1 1 1 -1 -1 -1 1.64569393883493E-02
0* -1 1 1 -1 -1 1 -1 -1 4.11122956231954E-03
2* -1 1 1 -1 -1 1 -1 1 3.89484905903956E-03
2* -1 1 1 -1 -1 1 1 -1 3.89484905903956E-03
4* -1 1 1 -1 -1 1 1 1 3.68985700330064E-03
0* -1 1 1 -1 1 -1 -1 -1 4.11122956231954E-03
2* -1 1 1 -1 1 -1 -1 1 3.89484905903956E-03
2* -1 1 1 -1 1 -1 1 -1 3.89484905903956E-03
4* -1 1 1 -1 1 -1 1 1 3.68985700330064E-03
2* -1 1 1 -1 1 1 -1 -1 3.89484905903956E-03
4* -1 1 1 -1 1 1 -1 1 3.68985700330064E-03
5 -1 1 1 -1 1 1 1 7.18551100642756E-03
0* -1 1 1 1 -1 -1 -1 -1 4.11122956231954E-03
2* -1 1 1 1 -1 -1 -1 1 3.89484905903956E-03
2* -1 1 1 1 -1 -1 1 -1 3.89484905903956E-03
4* -1 1 1 1 -1 -1 1 1 3.68985700330064E-03
2* -1 1 1 1 -1 1 -1 -1 3.89484905903956E-03
4* -1 1 1 1 -1 1 -1 1 3.68985700330064E-03
5 -1 1 1 1 -1 1 1 7.18551100642756E-03
5 -1 1 1 1 1 2.87630542918109E-02
0 4 1 -1 -1 -1 6.58758772592109E-02
0 6 1 -1 -1 1 -1 -1 1.64569393883493E-02
0* 1 -1 -1 1 -1 1 -1 -1 4.11122956231954E-03
2* 1 -1 -1 1 -1 1 -1 1 3.89484905903956E-03
2* 1 -1 -1 1 -1 1 1 -1 3.89484905903956E-03
4* 1 -1 -1 1 -1 1 1 1 3.68985700330064E-03
0* 1 -1 -1 1 1 -1 -1 -1 4.11122956231954E-03
2* 1 -1 -1 1 1 -1 -1 1 3.89484905903956E-03
2* 1 -1 -1 1 1 -1 1 -1 3.89484905903956E-03
4* 1 -1 -1 1 1 -1 1 1 3.68985700330064E-03
2* 1 -1 -1 1 1 1 -1 -1 3.89484905903956E-03
4* 1 -1 -1 1 1 1 -1 1 3.68985700330064E-03
5 1 -1 -1 1 1 1 1 7.18551100642756E-03
0 6 1 -1 1 -1 -1 -1 1.64569393883493E-02
0* 1 -1 1 -1 -1 1 -1 -1 4.11122956231954E-03
2* 1 -1 1 -1 -1 1 -1 1 3.89484905903956E-03
2* 1 -1 1 -1 -1 1 1 -1 3.89484905903956E-03
4* 1 -1 1 -1 -1 1 1 1 3.68985700330064E-03
0* 1 -1 1 -1 1 -1 -1 -1 4.11122956231954E-03
2* 1 -1 1 -1 1 -1 -1 1 3.89484905903956E-03
2* 1 -1 1 -1 1 -1 1 -1 3.89484905903956E-03
4* 1 -1 1 -1 1 -1 1 1 3.68985700330064E-03
2* 1 -1 1 -1 1 1 -1 -1 3.89484905903956E-03
4* 1 -1 1 -1 1 1 -1 1 3.68985700330064E-03
5 1 -1 1 -1 1 1 1 7.18551100642756E-03
0* 1 -1 1 1 -1 -1 -1 -1 4.11122956231954E-03
2* 1 -1 1 1 -1 -1 -1 1 3.89484905903956E-03
2* 1 -1 1 1 -1 -1 1 -1 3.89484905903956E-03
4* 1 -1 1 1 -1 -1 1 1 3.68985700330064E-03
2* 1 -1 1 1 -1 1 -1 -1 3.89484905903956E-03
4* 1 -1 1 1 -1 1 -1 1 3.68985700330064E-03
5 1 -1 1 1 -1 1 1 7.18551100642756E-03
5 1 -1 1 1 1 2.87630542918109E-02
0 6 1 1 -1 -1 -1 -1 1.64569393883493E-02
0* 1 1 -1 -1 -1 1 -1 -1 4.11122956231954E-03
2* 1 1 -1 -1 -1 1 -1 1 3.89484905903956E-03
2* 1 1 -1 -1 -1 1 1 -1 3.89484905903956E-03
4* 1 1 -1 -1 -1 1 1 1 3.68985700330064E-03
0* 1 1 -1 -1 1 -1 -1 -1 4.11122956231954E-03
2* 1 1 -1 -1 1 -1 -1 1 3.89484905903956E-03
2* 1 1 -1 -1 1 -1 1 -1 3.89484905903956E-03
4* 1 1 -1 -1 1 -1 1 1 3.68985700330064E-03
2* 1 1 -1 -1 1 1 -1 -1 3.89484905903956E-03
4* 1 1 -1 -1 1 1 -1 1 3.68985700330064E-03
5 1 1 -1 -1 1 1 1 7.18551100642756E-03
0* 1 1 -1 1 -1 -1 -1 -1 4.11122956231954E-03
2* 1 1 -1 1 -1 -1 -1 1 3.89484905903956E-03
2* 1 1 -1 1 -1 -1 1 -1 3.89484905903956E-03
4* 1 1 -1 1 -1 -1 1 1 3.68985700330064E-03
2* 1 1 -1 1 -1 1 -1 -1 3.89484905903956E-03
4* 1 1 -1 1 -1 1 -1 1 3.68985700330064E-03
5 1 1 -1 1 -1 1 1 7.18551100642756E-03
5 1 1 -1 1 1 2.87630542918109E-02
5 1 1 1 0.115136319665173
0.477732580021161 .258909570592026 .263357849386812 1
0 .263696128560993 .115136319665173 .131751754518422 8.62891628754327E-02 8.22846969417463E-02 5.74840880514205E-02 .263357849386812
done
where the E-02 represents *10^-2. So now, the probability of gambler's ruin in two bets slightly exceeds that of getting to bet number 8.
The number of ways of course remains the same, 88. Just the probabilities change.
|
Posted by Charlie
on 2016-05-20 17:48:05 |