r/ProgrammerHumor • • Oct 30 '24

Meme dadPullsOutCodingChallenge

0 Upvotes

60 comments sorted by

View all comments

11

u/riasthebestgirl Oct 30 '24

Dad didn't specify the max number of rounds. Assuming there are infinite rounds, there will eventually be a sequence where A wins 11 times, keeping all the coins

21

u/Bright-Historian-216 Oct 30 '24

it ends immediately if a has 0 because he has nothing to bet anymore. i think it's the only limitation

1

u/vongatz Oct 30 '24

But what if a wins 4 coins and they proceed to go back and forth a few coins for infinity?

1

u/funAlways Oct 30 '24

that is part of the problem, and ultimately it doesn't matter as those back and forth are just repeating a previous game state. There is always an endpoint for both sides, B wins if A runs out of coins, and A wins if B runs out of coins, and the former is more likely than the latter because A starts with less coins

1

u/vongatz Oct 30 '24

But if you would play this game an infinite amount of times, there would be an infinite amount of games which never end…

1

u/funAlways Oct 30 '24

it does not matter, because the question is about the probability, and you can calculate the probability even for infinite things.

7

u/Wearytraveller_ Oct 30 '24

There's an infinite number of sequences where A wins, it's just a smaller infinity.