All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Fateful Fickle Fifteen (Posted on 2005-03-24)
There is a bag with balls numbered 1 to 9. Two players take turns at randomly taking a ball from the bag. If a player gets three balls that sum fifteen, he wins. Getting fifteen with more or less balls doesn't count.

What are the odds of the first player winning? Of a draw?

 See The Solution Submitted by Old Original Oskar! Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 another approach -- solution | Comment 4 of 8 |

This program:

100   S\$="123456789"
110   for Seq=1 to !(len(S\$))
120     A1=val(mid(S\$,1,1)):A2=val(mid(S\$,3,1)):A3=val(mid(S\$,5,1))
130     B1=val(mid(S\$,2,1)):B2=val(mid(S\$,4,1)):B3=val(mid(S\$,6,1))
140     if A1+A2+A3=15 then goto *Wina3
145     if B1+B2+B3=15 then goto *Winb3
150     A4=val(mid(S\$,7,1)):A5=val(mid(S\$,9,1))
151     B4=val(mid(S\$,8,1))
160     if A1+A2+A4=15 then goto *Wina4
161     if A1+A3+A4=15 then goto *Wina4
162     if A2+A3+A4=15 then goto *Wina4
165     if B1+B2+B4=15 then goto *Winb4
166     if B1+B3+B4=15 then goto *Winb4
167     if B2+B3+B4=15 then goto *Winb4
170     if A1+A2+A5=15 then goto *Wina5
171     if A1+A3+A5=15 then goto *Wina5
172     if A1+A4+A5=15 then goto *Wina5
173     if A3+A4+A5=15 then goto *Wina5
174     if A2+A3+A5=15 then goto *Wina5
175     if A2+A4+A5=15 then goto *Wina5
176      Tie=Tie+1:goto *Counted
180    *Wina3:Wa3=Wa3+1:goto *Counted
181    *Wina4:Wa4=Wa4+1:goto *Counted
182    *Wina5:Wa5=Wa5+1:goto *Counted
183    *Winb3:Wb3=Wb3+1:goto *Counted
184    *Winb4:Wb4=Wb4+1:goto *Counted
190     *Counted
195    Total=Total+1
197   gosub *Permute(&S\$)
200   next
210   print Wa3;Wa4;Wa5,Wa3+Wa4+Wa5
215   print Wb3;Wb4,Wb3+Wb4
220   print Tie
1000   end
10010
10020    *Permute(&A\$)
10025   local X\$,I,J,L\$
10030     X\$=""
10040     for I=len(A\$) to 1 step -1
10050      L\$=X\$
10060      X\$=mid(A\$,I,1)
10070      if X\$<L\$ then cancel for:goto 10100
10080     next
10090
10100     if I=0 then
10110     :for J=1 to len(A\$)\2
10120     :X\$=mid(A\$,J,1)
10130     :mid(A\$,J,1)=mid(A\$,len(A\$)-J+1,1)
10140     :mid(A\$,len(A\$)-J+1,1)=X\$
10150     :next
10160     :else
10170     :for J=len(A\$) to I+1 step -1
10180     :if mid(A\$,J,1)>X\$ then cancel for:goto 10200:endif
10190     :next
10200     :mid(A\$,I,1)=mid(A\$,J,1)
10210     :mid(A\$,J,1)=X\$
10220     :for J=1 to (len(A\$)-I)\2
10230     :X\$=mid(A\$,I+J,1)
10240     :mid(A\$,I+J,1)=mid(A\$,len(A\$)-J+1,1)
10250     :mid(A\$,len(A\$)-J+1,1)=X\$
10260     :next
10270     :endif
10280    return
10290
resulting in

34560  95904  81792     212256
31968  72576    104544
46080
362880

Indicating:

Win by 1st player on his third ball:34560/362880 = 0.095238095238095
Win by 1st player on his fourth ball:95904/3628800 = .264285714285714
Win by 1st player on his fifth ball:81792/362880 = 0.225396825396825

Total player 1: 212256/362880 = .584920634920635

Win by 2nd player on his third ball:31968/362880 = .0880952380952381
Win by 2nd player on his fourth ball:72576/362880 = .2

Total player 2: 104544/362880 = .288095238095238

Tie:46080/362880 = .126984126984127

The tie value here was obtained by subtracting out the other amounts, and so the total must necessarily be 1.  However, this tie value agrees with that in my first post, and therefore forms a check. So I have confidence that the first player has probability 212256/362880 = 737/1260 = .584920634920635 of winning and that the probability of a draw is 46080/362880 = 8/63 = .126984126984127, and the second player has 104544/362880 = 121/420 = .288095238095238 probability of winning.

 Posted by Charlie on 2005-03-24 20:30:51

 Search: Search body:
Forums (0)