Home Archives Search Feed Football Squares How To Use



ATP W&S Open - Q/F (#11 Bautista Agut v. Gasquet): Will Bautista Agut WIN 3 STRAIGHT GAMES at ANY POINT in the 1st Set?


1:10PM
Yes: Bautista Agut wins 3 straight Games in 1st Set
No: Bautista Agut doesn’t win 3 straight Games in 1st Set


Inputs Needed To Solve

Service Games Won %
Bautista Agut and Gasquet

##### User Estimates #####

agut_SRV_Wperct = .82
gasquet_SRV_Wperct = .8

Method To Solve

## [1]

import numpy as np
def sim_game(server):
    if server:
        serve = np.random.choice([1,0],1,p=[agut_SRV_Wperct,1-agut_SRV_Wperct])
        if serve == 1:
            ans = '1'
        else:
            ans = '0'
        
    else:
        serve = np.random.choice([1,0],1,p=[gasquet_SRV_Wperct,1-gasquet_SRV_Wperct])
        if serve == 1:
            ans = '0'
        else:
            ans = '1'
        
    return ans
def set_over(winner):
    set_over = False
    
    if winner.count('1') >= 7:
        set_over = True
    if winner.count('0') >= 7:
        set_over = True
    if winner.count('1') >=6 and winner.count('0') < 5:
        set_over = True
    if winner.count('0') >=6 and winner.count('1') < 5:
        set_over = True
    if winner.count('0') == 6 and winner.count('1') == 6:
        set_over = True
    
    return set_over
def sim_set():
    winner = ''
    server = True
    set_over_ = False
    ans = 0

    while not set_over_:
        game = sim_game(server)
        winner += str(game)
        server = not server
        set_over_ = set_over(winner)
        
    _3_inarow = '111'
    
    _3 = 0
    if _3_inarow in winner:
        _3 = 1
    
    return _3
## [2]

iterations = 9999
_3count = 0

for i in range(iterations):
    _3count += sim_set()
        
p_W3 = _3count/iterations

Solution

print("The probability Bautista Agut WINS 3 STRAIGHT GAMES at ANY POINT in the 1st SET is ~%s" % round(p_W3,3))
The probability Bautista Agut WINS 3 STRAIGHT GAMES at ANY POINT in the 1st SET is ~0.458



Info

download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs

import sys
print(sys.version)
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Posted on 8/16/2019






← Next post    ·    Previous post →