## EXPERT ANSWER

the code is self explanatory

18 red balls

18 black balls 1 zero slot

probability of red ball is 18/37

probability of black ball is 18/37

probability of zero slot is 1/37

generate a random number in 0 to 1

if the number lies between 0 and 18/37 , its a red ball, increment money by 1

if the number lies between 18/37 and (18/37+18/37) its a black ball, decrement money by 1

if the number lies between (18/37+18/37) and 1 , then its a zero slot , decrement money by 1

if the money adds upto 20 its a play over

if the money becomes , its play over and brokecount is incremented by 1

iterate the above loop for 10,000 times , count brokecount

brokecount/10000 gives probability

```
Private Sub Play_Click()
Dim brokecount As Integer
Dim money As Integer
Dim probability As Long
Dim wincount As Integer
Dim flag As Integer
flag = 0
money = 10
brokecount = 0
For i = 1 To 10000
While flag <> 1
Randomize
R = Rnd()
If R <= 0.486 Then
money = money + 1
ElseIf R > 0.486 And R <= 0.972 Then
money = money - 1
ElseIf R > 0.972 Then
money = money - 1
End If
If money = 20 Then
flag = 1
End If
If money = 0 Then
brokecount = brokecount + 1
flag = 1
End If
Wend
flag = 0
money = 10
Next i
Range("D8") = brokecount / 10000
End Sub
```