Essayez de jouer avec un simulateur de baseball # 1 La carie d'alimentation est-elle efficace?

introduction

En tant que stratégie de baseball récente, il est dit qu'il vaut mieux frapper sans envoyer de carie sur la première base sans mort, mais je me demandais si c'était vraiment correct, alors je l'ai vérifié. Je pense que la même chose a déjà été faite, mais j'ai décidé de l'essayer pour ma propre étude.

Méthode

Je l'ai calculé en utilisant quelque chose de Monte Carlo. Le langage est Python. Le code est à la fin.

Hypothèse de grève

Les lignes frappantes suivantes sont supposées.

・ Tous les frappeurs sont uniformes ・ La probabilité de succès par siège est de 30%, et un tiers des coups sûrs sera à double base. ・ 35% de chances d'obtenir sur la base par siège ・ Si la probabilité de toucher un coup est de 65% et qu'un double kill se produit (exemple: pas de mort ou 1ère base avec un mort), 50% des coups seront tués deux fois. ・ Taux de survie à la base: par exemple, dans le cas du coureur 2e but, 100% sera marqué sur le 2e but et 50% sur un coup simple. ・ Dans le cas du coureur 3e base, environ 10% des coups sont traités comme une compression / un sacrifice (1 retrait, 1 score supplémentaire)

Il existe d'autres conditions détaillées selon le cas, mais j'omettrai l'explication. Voir le code pour plus de détails (désolé c'est difficile à voir ...).

À propos de la manipulation des caries d'alimentation

La manipulation de la carie d'alimentation est la suivante.

・ Au moment de l'absence de mort ou d'une mort 1ère base, ou pas de mort 12e base, avancez les coureurs au lieu d'en augmenter un (le premier devient un mort ou deux morts deuxième base, le second devient un mort 23e base). Le taux de réussite est de 100%.

Il est également supposé que les coups sûrs de base et de troisième base ne se produisent pas dans la partie hypothèse du frappeur, mais comme le carie d'alimentation est toujours traitée comme réussie, la tactique de carie d'alimentation est configurée pour fonctionner de manière avantageuse.

Résultat 1

L'axe horizontal est le nombre de manches d'attaque et l'axe vertical est le score attendu par manche. De plus, la ligne rouge montre la fluctuation de la valeur lorsque la mesure forcée est prise, et la ligne bleue montre la fluctuation de la valeur lorsque la mesure de carie d'envoi est prise. Comme le montre la figure, si la probabilité de toucher par siège est estimée à environ 30% en moyenne, on peut voir que le score attendu est plus élevé si vous prenez des mesures strictes. ex_v2_Simuresult.png

Résultat 2

J'ai calculé le cas où la probabilité de succès par siège a été modifiée à 25% et la probabilité d'obtenir une base par siège a été modifiée à 30%. Les autres conditions sont les mêmes que celles du calcul précédent. Comme le montre la figure, le score attendu est légèrement plus élevé lorsque la mesure de la carie alimentaire est prise. ex_v2_2_Simuresult.png

Résumé

Sans surprise, nous avons constaté que les stratégies efficaces changent en fonction de la probabilité de succès. Je n'ai pas essayé différentes conditions, donc je ne peux pas le dire inconditionnellement, mais je pense qu'il y a un tournant où la probabilité de succès par siège est d'environ 25% (ou la probabilité d'obtenir une base par siège est de 30%). ..

Après cela, le nombre de manches d'essai est trop petit pour les matchs de tournoi tels que le baseball au lycée, donc je pense qu'il y a une partie où l'on ne peut pas dire que l'une ou l'autre des stratégies fonctionne efficacement. Pour le dire autrement, je pense qu'il est intéressant que différentes meilleures stratégies donnent à chaque équipe une couleur différente.

À propos du futur

Je voudrais l'améliorer afin que le taux de réussite, etc. puisse être fixé strictement pour chaque frappeur, et je pense qu'il serait préférable d'inclure des facteurs tels que le vol.

code

Le code est indiqué ci-dessous. C'est très redondant et compliqué parce que c'est un débutant ... j'aimerais aussi améliorer cela. Le calcul ci-dessous concerne le résultat 2.

Baseball_Simulator_v1.py


#coding: utf-8
#average_Hitting=0.25
#average_go_on_base=0.30
import numpy as np
import random
import matplotlib.pyplot as plt

random.seed(0)

def HitResult(p,runner,out,R):
    #no runner
    if runner == 0:
        if p < 0.:
            R = R+1 #homerun
        elif p < 0.:
            runner = 3 #triple
        elif p < 0.083333:
            runner = 2 #double
        elif p < 0.30:
            runner = 1 #single
        else:
            out = out+1 #out
    #runner on base1
    elif runner == 1:
        if p < 0.:
            runner = 0
            R = R+2 #two run homerun
        elif p < 0.:
            runner = 3
            R = R+1 #clutch triple
        elif p < 0.041666:
            runner = 2
            R = R+1 #clutch double
        elif p < 0.083333:
            runner = 23 #double
        elif p < 0.166666:
            runner = 13 #single with base3
        elif p < 0.3:
            runner = 12 #single or walk
        elif p < 0.65:
            out = out+1 #out
        else:
            runner = 0
            out = out+2 #double play
    #runner on base2
    elif runner == 2:
        if p < 0.:
            runner = 0
            R = R+2 #two run homerun
        elif p < 0.:
            runner = 3 #clutch triple
            R = R+1
        elif p < 0.083333:
            R = R+1 #clutch double
        elif p < 0.166666:
            runner = 1
            R = R+1 #clutch single
        elif p < 0.25:
            runner = 13 #single
        elif p < 0.30:
            runner = 12 #walk
        elif p < 0.9:
            out = out+1 #out
        else:
            runner = 0
            out = out+2 #double play
    #runner on base3
    elif runner == 3:
        if p < 0.:
            runner = 0
            R = R+2 #two run homerun
        elif p < 0.:
            runner = 3
            R = R+1 #clutch triple
        elif p < 0.083333:
            runner = 2
            R = R+1 #clutch double
        elif p < 0.25:
            runner = 1
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 13 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 0
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.9:
            out = out+1 #out
        else:
            runner = 0
            out = out+2 #double play
    #runner on base1 and base2
    elif runner == 12:
        if p < 0.:
            runner = 0
            R = R+3 #three run homerun
        elif p < 0.:
            runner = 3
            R = R+2 #2 clutches triple
        elif p < 0.041666:
            runner = 2
            R = R+2 #2 clutches double
        elif p < 0.083333:
            runner = 23
            R = R+1 #clutch double
        elif p < 0.138888:
            runner = 13
            R = R+1 #clutch single with base3
        elif p < 0.194444:
            runner = 12
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 123 #single or walk
        elif p < 0.65:
            out = out+1 #out
        elif p < 0.825:
            runner = 2
            out = out+2 #double play through base3
        elif p < 0.99:
            runner = 3
            out = out+2 #double play through base2
        else:
            runner = 0
            out = out+3 #triple play
    #runner on base1 and base3
    elif runner == 13:
        if p < 0.:
            runner = 0
            R = R+3 #three run homerun
        elif p < 0.:
            runner = 3
            R = R+2 #2 clutches triple
        elif p < 0.041666:
            runner = 2
            R = R+2 #2 clutches double
        elif p < 0.083333:
            runner = 23
            R = R+1 #clutch double
        elif p < 0.166666:
            runner = 13
            R = R+1 #clutch single with base3
        elif p < 0.25:
            runner = 12
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 123 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 1
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.52:
            if out <= 1:
                R = R+1
                runner = 1
            out = out+1 #double play failure
        elif p < 0.68:
            out = out+1 #out
        elif p < 0.84:
            runner = 12
            out = out+1 #out on home
        elif p < 0.99:
            if out == 0:
                R = R+1
            out = out+2 #double play
        else:
            out = out+3 #triple play
    #runner on base2 and base3
    elif runner == 23:
        if p < 0.:
            runner = 0
            R = R+3 #three run homerun
        elif p < 0.:
            runner = 3
            R = R+2 #2 clutches triple
        elif p < 0.083333:
            runner = 2
            R = R+2 #2 clutches double
        elif p < 0.166666:
            runner = 1
            R = R+2 #2 clutches single
        elif p < 0.25:
            runner = 13
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 123 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 2
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.9:
            out = out+1 #out
        elif p < 0.995:
            runner = 2
            out = out+2 #double play
        else:
            runner = 0
            out = out+3 #triple play
    #runner on all bases
    else:
        if p < 0.:
            runner = 0
            R = R+4 #four run homerun
        elif p < 0.:
            runner = 3
            R = R+3 #3 clutches triple
        elif p < 0.041666:
            runner = 2
            R = R+3 #3 clutches double
        elif p < 0.083333:
            runner = 23
            R = R+2 #2 clutches double
        elif p < 0.138888:
            runner = 13
            R = R+2 #2 clutches single with base3
        elif p < 0.194444:
            runner = 12
            R = R+2 #2 clutches single
        elif p < 0.30:
            R = R+1 #clutch single or clutch walk
        elif p < 0.45:
            if out <= 1:
                runner = 12
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.675:
            out = out+1 #out
        elif p < 0.99:
            runner = 23
            out = out+2 #double play through home
        else:
            runner = 0
            out = out+3 #triple play

    return runner,out,R

def BuntResult(p,runner,out,R):
    #no runner
    if runner == 0:
        if p < 0.:
            R = R+1 #homerun
        elif p < 0.:
            runner = 3 #triple
        elif p < 0.1:
            runner = 2 #double
        elif p < 0.35:
            runner = 1 #single
        else:
            out = out+1 #out
    #runner on base1
    elif runner == 1:
        if out == 2:
            if p < 0.:
                runner = 0
                R = R+2 #two run homerun
            elif p < 0.:
                runner = 3
                R = R+1 #clutch triple
            elif p < 0.041666:
                runner = 2
                R = R+1 #clutch double
            elif p < 0.083333:
                runner = 23 #double
            elif p < 0.166666:
                runner = 13 #single with base3
            elif p < 0.30:
                runner = 12 #single
            elif p < 0.65:
                out = out+1 #out
            else:
                runner = 0
                out = out+2 #double play
        else:
            if p < 1.:
                runner = 2
                out = out+1 #sacrifice bunt
            elif p < 999:
                out = out+1 #bunt failure
            else:
                runner = 0
                out = out+2 #double play
    #runner on base2
    elif runner == 2:
        if out == 0:
            if p < 1.:
                runner = 3
                out = out+1 #sacrifice bunt
            elif p < 999:
                out = out+1 #bunt failure
            else:
                runner = 1
                out = out+1 #bunt failure
        else:
            if p < 0.:
                runner = 0
                R = R+2 #two run homerun
            elif p < 0.:
                runner = 3 #clutch triple
                R = R+1
            elif p < 0.083333:
                R = R+1 #clutch double
            elif p < 0.166666:
                runner = 1
                R = R+1 #clutch single
            elif p < 0.25:
                runner = 13 #single
            elif p < 0.30:
                runner = 12 #walk
            elif p < 0.9:
                out = out+1 #out
            else:
                runner = 0
                out = out+2 #double play
    #runner on base3
    elif runner == 3:
        if p < 0.:
            runner = 0
            R = R+2 #two run homerun
        elif p < 0.:
            runner = 3
            R = R+1 #clutch triple
        elif p < 0.083333:
            runner = 2
            R = R+1 #clutch double
        elif p < 0.25:
            runner = 1
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 13 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 0
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.9:
            out = out+1 #out
        else:
            runner = 0
            out = out+2 #double play
    #runner on base1 and base2
    elif runner == 12:
        if out == 0:
            if p < 1.:
                runner = 23
                out = out+1 #sacrifice bunt
            elif p < 999:
                out = out+1 #bunt failure
            else:
                runner = 2
                out = out+2 #bunt failure (double play)
        else:
            if p < 0.:
                runner = 0
                R = R+3 #three run homerun
            elif p < 0.:
                runner = 3
                R = R+2 #2 clutches triple
            elif p < 0.041666:
                runner = 2
                R = R+2 #2 clutches double
            elif p < 0.083333:
                runner = 23
                R = R+1 #clutch double
            elif p < 0.138888:
                runner = 13
                R = R+1 #clutch single with base3
            elif p < 0.194444:
                runner = 12
                R = R+1 #clutch single
            elif p < 0.30:
                runner = 123 #single or walk
            elif p < 0.65:
                out = out+1 #out
            elif p < 0.825:
                runner = 2
                out = out+2 #double play through base3
            elif p < 0.99:
                runner = 3
                out = out+2 #double play through base2
            else:
                runner = 0
                out = out+3 #triple play
    #runner on base1 and base3
    elif runner == 13:
        if p < 0.:
            runner = 0
            R = R+3 #three run homerun
        elif p < 0.:
            runner = 3
            R = R+2 #2 clutches triple
        elif p < 0.041666:
            runner = 2
            R = R+2 #2 clutches double
        elif p < 0.083333:
            runner = 23
            R = R+1 #clutch double
        elif p < 0.166666:
            runner = 13
            R = R+1 #clutch single with base3
        elif p < 0.25:
            runner = 12
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 123 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 1
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.52:
            if out <= 1:
                R = R+1
                runner = 1
            out = out+1 #double play failure
        elif p < 0.68:
            out = out+1 #out
        elif p < 0.84:
            runner = 12
            out = out+1 #out on home
        elif p < 0.99:
            if out == 0:
                R = R+1
            out = out+2 #double play
        else:
            out = out+3 #triple play
    #runner on base2 and base3
    elif runner == 23:
        if p < 0.:
            runner = 0
            R = R+3 #three run homerun
        elif p < 0.:
            runner = 3
            R = R+2 #2 clutches triple
        elif p < 0.083333:
            runner = 2
            R = R+2 #2 clutches double
        elif p < 0.166666:
            runner = 1
            R = R+2 #2 clutches single
        elif p < 0.25:
            runner = 13
            R = R+1 #clutch single
        elif p < 0.30:
            runner = 123 #walk
        elif p < 0.45:
            if out <= 1:
                runner = 2
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.9:
            out = out+1 #out
        elif p < 0.995:
            runner = 2
            out = out+2 #double play
        else:
            runner = 0
            out = out+3 #triple play
    #runner on all bases
    else:
        if p < 0.:
            runner = 0
            R = R+4 #four run homerun
        elif p < 0.:
            runner = 3
            R = R+3 #3 clutches triple
        elif p < 0.041666:
            runner = 2
            R = R+3 #3 clutches double
        elif p < 0.083333:
            runner = 23
            R = R+2 #2 clutches double
        elif p < 0.138888:
            runner = 13
            R = R+2 #2 clutches single with base3
        elif p < 0.194444:
            runner = 12
            R = R+2 #2 clutches single
        elif p < 0.30:
            R = R+1 #clutch single or clutch walk
        elif p < 0.45:
            if out <= 1:
                runner = 12
                R = R+1
            out = out+1 #sacrifice out
        elif p < 0.65:
            out = out+1 #out
        elif p < 0.99:
            runner = 23
            out = out+2 #double play through home
        else:
            runner = 0
            out = out+3 #triple play

    return runner,out,R

#Initial condition
inning = 1
max_inning = 10000
runner = 0
out = 0
R = 0
sum_num1 = 0
sum_num2 = 0
sum_num3 = 0
sum_num4 = 0
sum_num5 = 0
sum_num6 = 0
sum_num7 = 0
sum_num8 = 0
sum_num9 = 0
sum_num10 = 0

R_array_Hit1 = np.zeros((max_inning+1,1))
R_array_Hit2 = np.zeros((max_inning+1,1))
R_array_Hit3 = np.zeros((max_inning+1,1))
R_array_Hit4 = np.zeros((max_inning+1,1))
R_array_Hit5 = np.zeros((max_inning+1,1))
R_array_Hit6 = np.zeros((max_inning+1,1))
R_array_Hit7 = np.zeros((max_inning+1,1))
R_array_Hit8 = np.zeros((max_inning+1,1))
R_array_Hit9 = np.zeros((max_inning+1,1))
R_array_Hit10 = np.zeros((max_inning+1,1))

Exp_R_Hit1 = np.zeros((max_inning+1,1))
Exp_R_Hit2 = np.zeros((max_inning+1,1))
Exp_R_Hit3 = np.zeros((max_inning+1,1))
Exp_R_Hit4 = np.zeros((max_inning+1,1))
Exp_R_Hit5 = np.zeros((max_inning+1,1))
Exp_R_Hit6 = np.zeros((max_inning+1,1))
Exp_R_Hit7 = np.zeros((max_inning+1,1))
Exp_R_Hit8 = np.zeros((max_inning+1,1))
Exp_R_Hit9 = np.zeros((max_inning+1,1))
Exp_R_Hit10 = np.zeros((max_inning+1,1))

#inning_array = np.zeros((max_inning+1,1))

#Simulation in case of hitting
for i in range(1,11):
    for inning in range(1,max_inning+1):
        while True:
            p = random.random()
            runner,out,R = HitResult(p,runner,out,R)
            if out >= 3:
                break
        if i == 1:
            R_array_Hit1[inning,0] = R
            sum_num1 = sum_num1 + R
            Exp_R_Hit1[inning,0] = float(sum_num1)/inning
        elif i == 2:
            R_array_Hit2[inning,0] = R
            sum_num2 = sum_num2 + R
            Exp_R_Hit2[inning,0] = float(sum_num2)/inning
        elif i == 3:
            R_array_Hit3[inning,0] = R
            sum_num3 = sum_num3 + R
            Exp_R_Hit3[inning,0] = float(sum_num3)/inning
        elif i == 4:
            R_array_Hit4[inning,0] = R
            sum_num4 = sum_num4 + R
            Exp_R_Hit4[inning,0] = float(sum_num4)/inning
        elif i == 5:
            R_array_Hit5[inning,0] = R
            sum_num5 = sum_num5 + R
            Exp_R_Hit5[inning,0] = float(sum_num5)/inning
        elif i == 6:
            R_array_Hit6[inning,0] = R
            sum_num6 = sum_num6 + R
            Exp_R_Hit6[inning,0] = float(sum_num6)/inning
        elif i == 7:
            R_array_Hit7[inning,0] = R
            sum_num7 = sum_num7 + R
            Exp_R_Hit7[inning,0] = float(sum_num7)/inning
        elif i == 8:
            R_array_Hit8[inning,0] = R
            sum_num8 = sum_num8 + R
            Exp_R_Hit8[inning,0] = float(sum_num8)/inning
        elif i == 9:
            R_array_Hit9[inning,0] = R
            sum_num9 = sum_num9 + R
            Exp_R_Hit9[inning,0] = float(sum_num9)/inning
        else:
            R_array_Hit10[inning,0] = R
            sum_num10 = sum_num10 + R
            Exp_R_Hit10[inning,0] = float(sum_num10)/inning
        #Initialize conditions
        runner = 0
        out = 0
        R = 0
        inning = inning+1
    i = i+1


#Initial condition
inning = 1
max_inning = 10000
runner = 0
out = 0
R = 0
sum_num1 = 0
sum_num2 = 0
sum_num3 = 0
sum_num4 = 0
sum_num5 = 0
sum_num6 = 0
sum_num7 = 0
sum_num8 = 0
sum_num9 = 0
sum_num10 = 0

R_array_Bunt1 = np.zeros((max_inning+1,1))
R_array_Bunt2 = np.zeros((max_inning+1,1))
R_array_Bunt3 = np.zeros((max_inning+1,1))
R_array_Bunt4 = np.zeros((max_inning+1,1))
R_array_Bunt5 = np.zeros((max_inning+1,1))
R_array_Bunt6 = np.zeros((max_inning+1,1))
R_array_Bunt7 = np.zeros((max_inning+1,1))
R_array_Bunt8 = np.zeros((max_inning+1,1))
R_array_Bunt9 = np.zeros((max_inning+1,1))
R_array_Bunt10 = np.zeros((max_inning+1,1))

Exp_R_Bunt1 = np.zeros((max_inning+1,1))
Exp_R_Bunt2 = np.zeros((max_inning+1,1))
Exp_R_Bunt3 = np.zeros((max_inning+1,1))
Exp_R_Bunt4 = np.zeros((max_inning+1,1))
Exp_R_Bunt5 = np.zeros((max_inning+1,1))
Exp_R_Bunt6 = np.zeros((max_inning+1,1))
Exp_R_Bunt7 = np.zeros((max_inning+1,1))
Exp_R_Bunt8 = np.zeros((max_inning+1,1))
Exp_R_Bunt9 = np.zeros((max_inning+1,1))
Exp_R_Bunt10 = np.zeros((max_inning+1,1))

#inning_array = np.zeros((max_inning+1,1))

#Simulation in case of bunt
for i in range(1,11):
    for inning in range(1,max_inning+1):
        while True:
            p = random.random()
            runner,out,R = BuntResult(p,runner,out,R)
            if out >= 3:
                break
        if i == 1:
            R_array_Bunt1[inning,0] = R
            sum_num1 = sum_num1 + R
            Exp_R_Bunt1[inning,0] = float(sum_num1)/inning
        elif i == 2:
            R_array_Bunt2[inning,0] = R
            sum_num2 = sum_num2 + R
            Exp_R_Bunt2[inning,0] = float(sum_num2)/inning
        elif i == 3:
            R_array_Bunt3[inning,0] = R
            sum_num3 = sum_num3 + R
            Exp_R_Bunt3[inning,0] = float(sum_num3)/inning
        elif i == 4:
            R_array_Bunt4[inning,0] = R
            sum_num4 = sum_num4 + R
            Exp_R_Bunt4[inning,0] = float(sum_num4)/inning
        elif i == 5:
            R_array_Bunt5[inning,0] = R
            sum_num5 = sum_num5 + R
            Exp_R_Bunt5[inning,0] = float(sum_num5)/inning
        elif i == 6:
            R_array_Bunt6[inning,0] = R
            sum_num6 = sum_num6 + R
            Exp_R_Bunt6[inning,0] = float(sum_num6)/inning
        elif i == 7:
            R_array_Bunt7[inning,0] = R
            sum_num7 = sum_num7 + R
            Exp_R_Bunt7[inning,0] = float(sum_num7)/inning
        elif i == 8:
            R_array_Bunt8[inning,0] = R
            sum_num8 = sum_num8 + R
            Exp_R_Bunt8[inning,0] = float(sum_num8)/inning
        elif i == 9:
            R_array_Bunt9[inning,0] = R
            sum_num9 = sum_num9 + R
            Exp_R_Bunt9[inning,0] = float(sum_num9)/inning
        else:
            R_array_Bunt10[inning,0] = R
            sum_num10 = sum_num10 + R
            Exp_R_Bunt10[inning,0] = float(sum_num10)/inning
        #Initialize conditions
        runner = 0
        out = 0
        R = 0
        inning = inning+1
    i = i+1

ave_Exp_R_Hit = np.zeros((max_inning+1,1))
ave_Exp_R_Bunt = np.zeros((max_inning+1,1))

all_Exp_R_Hit = np.array([])
all_Exp_R_Hit = np.hstack((Exp_R_Hit1,Exp_R_Hit2,Exp_R_Hit3,Exp_R_Hit4,Exp_R_Hit5,Exp_R_Hit6,Exp_R_Hit7,Exp_R_Hit8,Exp_R_Hit9,Exp_R_Hit10))
all_Exp_R_Bunt = np.array([])
all_Exp_R_Bunt = np.hstack((Exp_R_Bunt1,Exp_R_Bunt2,Exp_R_Bunt3,Exp_R_Bunt4,Exp_R_Bunt5,Exp_R_Bunt6,Exp_R_Bunt7,Exp_R_Bunt8,Exp_R_Bunt9,Exp_R_Bunt10))

for inning in range(1,max_inning+1):
    ave_Exp_R_Hit[inning,0] = np.average(all_Exp_R_Hit[inning,:])
    ave_Exp_R_Bunt[inning,0] = np.average(all_Exp_R_Bunt[inning,:])

print "Exp_RunScore_Hitting",ave_Exp_R_Hit[max_inning,0]
print "Exp_RunScore_Bunt",ave_Exp_R_Bunt[max_inning,0]

plt.xlabel("Number of innings")
plt.ylabel("Expected Runs Score per inning")
plt.axis([0,max_inning,0.0,2])
plt.plot(Exp_R_Hit1,'r',alpha=0.2)
plt.plot(Exp_R_Hit2,'r',alpha=0.2)
plt.plot(Exp_R_Hit3,'r',alpha=0.2)
plt.plot(Exp_R_Hit4,'r',alpha=0.2)
plt.plot(Exp_R_Hit5,'r',alpha=0.2)
plt.plot(Exp_R_Hit6,'r',alpha=0.2)
plt.plot(Exp_R_Hit7,'r',alpha=0.2)
plt.plot(Exp_R_Hit8,'r',alpha=0.2)
plt.plot(Exp_R_Hit9,'r',alpha=0.2)
plt.plot(Exp_R_Hit10,'r',alpha=0.2)
plt.plot(ave_Exp_R_Hit,'r',label="Hitting")

plt.plot(Exp_R_Bunt1,'b',alpha=0.2)
plt.plot(Exp_R_Bunt2,'b',alpha=0.2)
plt.plot(Exp_R_Bunt3,'b',alpha=0.2)
plt.plot(Exp_R_Bunt4,'b',alpha=0.2)
plt.plot(Exp_R_Bunt5,'b',alpha=0.2)
plt.plot(Exp_R_Bunt6,'b',alpha=0.2)
plt.plot(Exp_R_Bunt7,'b',alpha=0.2)
plt.plot(Exp_R_Bunt8,'b',alpha=0.2)
plt.plot(Exp_R_Bunt9,'b',alpha=0.2)
plt.plot(Exp_R_Bunt10,'b',alpha=0.2)
plt.plot(ave_Exp_R_Bunt,'b',label="Bunt")
plt.legend()
plt.grid(True)
plt.savefig('ex_v2_2_Simuresult.png')
'''
plt.hist(R_array_Hit,bins=10)
plt.hist(R_array_Bunt,bins=10)
plt.show()
'''

quit()

Recommended Posts

Essayez de jouer avec un simulateur de baseball # 1 La carie d'alimentation est-elle efficace?
Essayez de programmer avec un shell!
L'image est Namekuji
La nouvelle Corona est-elle vraiment une menace? Validé avec Stan (était)
[Python] Qu'est-ce qu'une instruction with?
L'espace est dangereux avec PyEphem
Essayez de brouiller l'image avec opencv2
Essayez de résoudre le problème du voyageur de commerce avec un algorithme génétique (théorie)
Construisez un environnement de simulateur de drone et essayez un vol simple avec Mission Planner