In the game “Drop Dead,” you roll
a number of six-sided dice. If a roll
does not include any 2s or 5s, you
add the sum of the dice to your
score and roll all of the dice again.
If your roll does include 2s or 5s,
you receive no points for that roll,
the dice with 2s or 5s are discarded,
and the remaining dice are rolled again. You repeat this procedure until all dice have been discarded.
If you start with five dice, what is your
expected score by the time you have
discarded all of your dice?
I found the same simulation results as Charlie ± precision error since I did only 10^5 trials.
But I wanted to attempt an analytic solution.
My results for 1, 2, or 3 dice agree with the simulation results, but there must be an error when I increased to 4 dice.
(Starting with 3 dice, I used Wolfram Alpha for the arithmetic)
Call Sn the expected score for n dice.
Obviously S0 = 0
S1 = (2/3)*(7/2 + S1) = 7/3 + (2/3)S1
S1 = 7 for one die
S2 = (2/3)^2((7/2)*2 + S2) + (1/3)(2/3)(2)(0 + S1)
= (4/9)(7) + (4/9)S2 + (4/9)(7)
= 56/9 + (4/9)S2
= (9/5)(56/9) = 56/5 = 11.2 for two dice
S3 = 1*(2/3)^3((7/2)*3 + S3)
+ 3*((1/3)(2/3)^2) (0 + S2)
+ 3*((1/3)^2(2/3)) (0 + S1)
= (8/27)(21/2 + S3)
+ (12/27)(56/5)
+ (6/27)(7)
= 1302/95 = 13.705263157894738 for three dice
S4 = 1*(2/3)^4((7/2)*4 + S4)
+ 4*(1/3)(2/3)^3 (0 + S3)
+ 6*(1/3)^2*(2/3)^2 (0 + S2)
+ 4*(1/3)^3(2/3) (0 + S1)
= 1*(16/81) ((14 + S4)
+ 4*(8/81) (0 + 1302/95)
+ 6*(4/81) (0 + 56/5)
+ 4*(2/81) (0 + 7)
S4 = 115360/20007 = 5.765981906332784
which disagrees with the Sim results
(should be about 15.24 so there is an error)
my simulation results:
1 7.03203
2 11.19352
3 13.68761
4 15.24479
5 16.0118
6 16.4506
7 16.91077
8 17.0097
9 16.99697
10 17.24173
my code:
-----------
reps = 100000
for dice in range(1,11):
ct = 0
score_total = 0
for rep in range(reps):
ct += 1
dicenow = dice
thisscore = 0
while dicenow > 0:
roll = [randint(1,6) for n in range(dicenow)]
bads = roll.count(2) + roll.count(5)
if bads > 0:
dicenow -= bads
continue
thisscore += sum(roll)
score_total += thisscore
print(dice,score_total / ct)
|
Posted by Larry
on 2024-12-02 08:51:50 |