A player draws the cards from the a 52-card deck one by one, without putting them back in the deck.
Every time before drawing a card he guesses the suit of the card he will draw.
He decides to always guess the suit that occurs most frequently in the remaining deck (if there are
several such suits, he chooses any one of them).
Prove that he will guess the right suit at least 13
times.
Following the strategy, the following is the distribution of the number of hits:
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 673
14 3022
15 6948
16 11863
17 15189
18 16616
19 14851
20 11656
21 8350
22 5194
23 2953
24 1519
25 701
26 292
27 113
28 39
29 12
30 6
31 3
32 0
33 0
34 0
35 0
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 0
46 0
47 0
48 0
49 0
50 0
51 0
52 0
The overall average number of hits was 18.41549.
DefDbl A-Z
Dim crlf$, sremain(4), shist(52)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For x = 1 To 10
Randomize Timer
For tr = 1 To 10000
For i = 1 To 4
sremain(i) = 13
Next
tremain = 52: score = 0
For turn = 1 To 52
mx = sremain(1): wh = 1
For i = 2 To 4
If sremain(i) > mx Then mx = sremain(i): wh = i
Next
r = Int(Rnd(1) * tremain + 1)
For i = 1 To 4
If sremain(i) >= r Then nxtcard = i: Exit For
r = r - sremain(i)
Next
If nxtcard = wh Then score = score + 1
sremain(nxtcard) = sremain(nxtcard) - 1
tremain = tremain - 1
Next turn
shist(score) = shist(score) + 1
Next tr
Next x
wttot = 0
For i = 1 To 52
Text1.Text = Text1.Text & mform(i, "##") & mform(shist(i), "#####0") & crlf
wttot = wttot + i * shist(i)
ntot = ntot + shist(i)
Next
Text1.Text = Text1.Text & wttot / ntot & crlf
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|
Posted by Charlie
on 2015-07-21 10:25:25 |