match¶
- tennis_probability.match(sets_won_a: int, sets_won_b: int, p: float, best_out_of_n_sets: int = 5) float¶
- Recursively calculates the probability of player A winning at any state in a match. - This function calls and uses both the set and game function. - Parameters:
- sets_won_a – The score for player A. 
- sets_won_b – The score for player B. 
- p – The independent probability of player A winning any given point. 
- best_out_of_n_sets – The number of sets played. Typically, this would be 5 sets for mens, and 3 sets for womens. The default is 5, since that is the number of sets played for mens. 
 
- Raises:
- NegativeNumber – When either the score is negative or the num_of_sets_played. 
- 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 match.