game¶
- tennis_probability.game(score_a: int, score_b: int, p: float) float ¶
Recursively calculates the probability of player A winning at any state in a game.
- Parameters:
score_a – The score for player A.
score_b – The score for player B.
p – The independent probability of player A winning any given point in a game.
- Raises:
NegativeNumber – When either score is negative.
InvalidInput – When the score for the players is invalid - arguments games_won_a and games_won_b.
InvalidProbability – When the probability is invalid - the p_game argument.
- Returns:
The probability of player A winning the game.