A wealthy mathematician WG offered you a proposition you cannot refuse: participate for one hour exactly in one of the following games:
a. Throw four regular fair dice and if at least one six appears you get a dollar, otherwise you pay a dollar.
b. Keep executing throws of two fair dice until both show a six - you win a dollar , but if 25 throws were unsuccessful you lose a dollar and begin a new round of 25 or less (when 2 sixes appeared earlier).
If the time limit expires within the “25 throw” sequence the current run is aborted.
WG thinks that in both cases the chances are about fifty-fifty
1. What would be your choice assuming you were given 60 seconds to make up your mind?
2.Solve analytically what would be the expected winnings in each of the cases.
3. Get the answers by simulating both cases.
Assume that a throw lasts 10 seconds and the payouts are executed in no time.
Please compare the results of 1, 2, 3.
I ran 10,000 trials (where each trial is an hour of playing each game) and got average profit of 12.9348 for game A and 0.5168 for game B. Close enough to what I got with my analytical approach that I think it's probably right.
Used the following Python code (note, I'm not a programmer by trade so excuse any amateurish blunders):
from random import randint
total_balance_a = 0
total_balance_b = 0
trials = 10000
for t in range(trials):
# Game A
balance_a = 0
time = 3600
while time > 0:
time -= 10
a1 = randint(1,6)
a2 = randint(1,6)
a3 = randint(1,6)
a4 = randint(1,6)
if a1 == 6 or a2 == 6 or a3 == 6 or a4 == 6:
balance_a += 1
else:
balance_a -= 1
total_balance_a += balance_a
# Game B
balance_b = 0
time = 3600
failure_ct = 0
while time > 0:
time -= 10
failure_ct += 1
b1 = randint(1,6)
b2 = randint(1,6)
if b1 == 6 and b2 == 6:
balance_b += 1
failure_ct = 0
elif failure_ct == 25:
balance_b -= 1
failure_ct = 0
else:
continue
total_balance_b += balance_b
print(total_balance_a / trials)
print(total_balance_b / trials)
|
Posted by tomarken
on 2021-05-28 09:09:08 |