Andy and Becky are playing a coin-tossing game. Whoever gets more heads win the game. Andy gets 100 tosses and Becky 101. If they both get the same number, Andy wins. What is the probability that Andy to win the competition?
Let’s do a Monte Carlo on this and find out who.
B<- 100000
results <- replicate(B, {
Andy <- sum(sample(c(1,0), 100, replace = TRUE, prob = c(0.5,0.5)))
Becky <- sum(sample(c(1,0), 101, replace = TRUE, prob = c(0.5,0.5)))
if (Andy >= Becky){
counter = 1
}else{
counter = 0
}
})
mean(results)
The answer comes out to be close to 0.5. What happens if they play only 2 and 3 games, respectively?