You have one token, and I have two tokens. Naturally, we both crave more tokens, so we play a game of skill that unfolds over a number of rounds in which the winner of each round gets to steal one token from the loser. The game itself ends when one of us is out of tokens — that person loses. Suppose that you’re better than me at this game and that you win each round two-thirds of the time and lose one-third of the time.
What is your probability of winning the game?
from random import random runs = 100000 cnt = 0 for _ in range(runs): me, you = 1, 2 while(you != 0 and me != 0): if random() <= 2/3: you -= 1 me += 1 else: you += 1 me -= 1 if you == 0: cnt += 1 print(cnt/runs)
The probability of me winning the game is $.57$.