A and B each put 10 coins in the
pot. A then takes a coin from the pot
and tosses it, while B calls heads or
tails. If B’s call is correct, he takes
the coin and keeps it; otherwise, A
keeps the coin. B then takes a coin
from the remaining pot and tosses it
while A calls heads or tails.
The play
continues in this way until one player
has accumulated 10 coins, whereupon
he wins the game and takes all the
coins remaining in the pot. At one
point in the play, A has six coins,
while B has only four. What is A’s
probability of winning?
When the
situation occurs in a game such that
one player has won six coins while
his opponent has won four coins,
what is the expected value of the
winnings (net number of coins) of the
player with six coins?
clearvars
atot=0;btot=0;
grid=zeros(10);
grid(6,4)=1;
for toss=11:20
newgrid=zeros(10);
for row=1:9
for col=1:9
newgrid(row+1,col)=newgrid(row+1,col)+grid(row,col)/2;
if row+1==10
atot=atot+grid(row,col)/2;
end
newgrid(row,col+1)=newgrid(row,col+1)+grid(row,col)/2;
if col+1==10
btot=btot+grid(row,col)/2;
end
end
end
grid=newgrid;
end
atot
btot
finds that the probability A wins is 0.74609375 (with B having the other 0.25390625). A's probability is also expressed as 191/256.
A's overall expected gain is 1910/256 = 7.4609375, that is, if the 10 coins is considered as the winnings. Subtract 6 if you mean the extra winnings past his already "gained" 6, which aren't actually his to keep unless he gets the whole pot.
Actually, the above neglects to include possible loss in the calculation. I should be (1910-650)/256 = 4.921875.
Edited on January 13, 2025, 9:21 am
|
Posted by Charlie
on 2025-01-13 09:17:17 |