Advertisement
dougbaker45

football_0.9

Aug 25th, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 22.99 KB | None | 0 0
  1. import random
  2. from timeit import default_timer as timer
  3. start = timer()
  4. hometeam = 'New England Patriots'
  5. awayteam = 'Arizona Cardinals'
  6. finalscores = []
  7. matchcount = 1
  8. def statsreset():
  9.     global gamesplayed
  10.     global offset
  11.     global games
  12.     global gametime
  13.     global playtime
  14.     global possession
  15.     global ballposition
  16.     global down
  17.     global seriesyards
  18.     global awayteamscores
  19.     global hometeamscores
  20.     global totalstats
  21.     global totalscores
  22.     global atstats
  23.     global htstats
  24.     global interceptionhappened
  25.     offset = 1000
  26.     games = 0
  27.     gametime = 60
  28.     playtime = .4
  29.     possession = None
  30.     ballposition = 0
  31.     down = 0
  32.     seriesyards = 0
  33.     awayteamscores = 0
  34.     hometeamscores = 0
  35.     interceptionhappened = 'no'
  36.     scores = {hometeam:0, awayteam:0}
  37.     totalscores = {hometeam:0, awayteam:0}
  38.     totalstats = {'totalrunplays':0, 'totalpassplays':0, 'totalpuntplays':0, 'totalfieldgoalplays':0, 'totalrushyards':0, 'totalpassyards':0, 'totalpuntyards':0, 'totalcompletions':0, 'cointosswinner '+str(hometeam):0, 'cointosswinner '+str(awayteam):0}
  39.     htstats = {'totalrunplays':0, 'totalpassplays':0, 'totalpuntplays':0, 'totalfieldgoalplays':0, 'totalrushyards':0, 'totalpassyards':0, 'totalpuntyards':0, 'totalcompletions':0, 'cointosswinner '+str(hometeam):0}
  40.     atstats = {'totalrunplays':0, 'totalpassplays':0, 'totalpuntplays':0, 'totalfieldgoalplays':0, 'totalrushyards':0, 'totalpassyards':0, 'totalpuntyards':0, 'totalcompletions':0, 'cointosswinner '+str(awayteam):0}
  41.  
  42.  
  43. def teamstats():
  44.     global possession
  45.     import csv
  46.     global htoffense
  47.     global atoffense
  48.     global htdefense
  49.     global atdefense
  50.     global htKicking_Punting
  51.     global atKicking_Punting
  52.     global htreturning
  53.     global atreturning
  54.  
  55.     if possession == hometeam:
  56.         nonpossession = awayteam
  57.     else: nonpossession = hometeam
  58.  
  59.     with open('offense.csv', newline='') as csvfile:
  60.          offenses = csv.DictReader(csvfile)
  61.          for row in offenses:
  62.              #print(row)
  63.              if row['Tm'] == hometeam:
  64.                 htoffense = row
  65.              if row['Tm'] == awayteam:
  66.                 atoffense = row
  67.  
  68.     with open('defense.csv', newline='') as csvfile:
  69.          defenses = csv.DictReader(csvfile)
  70.          for row in defenses:
  71.              #print(row)
  72.              if row['Tm'] == hometeam:
  73.                  htdefense = row
  74.              if row['Tm'] == awayteam:
  75.                  atdefense = row
  76.  
  77.     with open('Kicking_Punting.csv', newline='') as csvfile:
  78.          Kicking_Punting = csv.DictReader(csvfile)
  79.          for row in Kicking_Punting:
  80.              #print(row)
  81.              if row['Tm'] == hometeam:
  82.                  htKicking_Punting = row
  83.              if row['Tm'] == awayteam:
  84.                  atKicking_Punting = row
  85.  
  86.     with open('returning.csv', newline='') as csvfile:
  87.          returning = csv.DictReader(csvfile)
  88.          for row in returning:
  89.              #print(row)
  90.              if row['Tm'] == hometeam:
  91.                  htreturning = row
  92.              if row['Tm'] == awayteam:
  93.                  atreturning = row
  94.     #print(htKicking_Punting)
  95.     #print(atKicking_Punting)
  96.     #print(htreturning)
  97.     #print(atreturning)
  98. def cointoss():
  99.     global gametime
  100.     global possession
  101.     global halftimepossession
  102.     global scores
  103.     gametime = 60
  104.     scores = {hometeam:0, awayteam:0}
  105.     cointossresult = random.randint(1, 2)
  106.     if cointossresult == 1:
  107.         possession = hometeam
  108.         halftimepossession = awayteam
  109.         totalstats['cointosswinner '+str(awayteam)] += 1
  110.         atstats['cointosswinner '+str(awayteam)] += 1
  111.     else:
  112.         possession = awayteam
  113.         halftimepossession = hometeam
  114.         totalstats['cointosswinner '+str(hometeam)] += 1
  115.         htstats['cointosswinner '+str(hometeam)] += 1
  116.     #print('cointoss winner', halftimepossession)
  117.  
  118. def halftime():
  119.     global possession
  120.     global halftimepossession
  121.     global scores
  122.     global ballposition
  123.     #print(ballposition)
  124.     #print(gametime)
  125.     if ballposition >= 4000:
  126.         fieldgoalplayexecute()
  127.     possession = halftimepossession
  128.     #print('')
  129.     #print('')
  130.     #print('halftime')
  131.     kickoff()
  132.  
  133. def kickoff():
  134.     global ballposition
  135.     global gametime
  136.     global possession
  137.     global down
  138.     ballposition = 0
  139.     returnteam = possession
  140.     kickofftd = random.randint(1, 100)
  141.     gametime -= random.uniform(.2, .6)
  142.     if kickofftd <= 1:
  143.         scores[returnteam] += 6
  144.         extrapointexecute()
  145.         turnover()
  146.         kickoff()
  147.     else:
  148.         if possession == hometeam:
  149.             ballposition = float(htreturning['Kick Returns Y/Rt']) * 97
  150.             #print(hometeam, 'kickoff returned to :', ballposition)
  151.         if possession == awayteam:
  152.             ballposition = float(atreturning['Kick Returns Y/Rt']) * 97
  153.             #print(awayteam, 'kickoff returned to :', ballposition)
  154.         down = 1
  155.         kickoffbigplay = random.randint(1, 100)
  156.         if kickoffbigplay <= 4:
  157.             ballposition += random.randint(1, 2500)
  158.             #print('Kickoff big play!', kickoffbigplay)
  159.             #print('ballposition', ballposition)
  160.     #print('ballposition', ballposition)
  161.     #print('gametime', gametime)
  162.  
  163. def chooseplay():
  164.     global possession
  165.     global down
  166.     global playchoice
  167.     global ballposition
  168.     offense = possession
  169.     #print(htoffense['Rushing Att'])
  170.     #print((100 * (int(atoffense['Rushing Att']) / int(atoffense['Tot Ply']))))
  171.     if possession == hometeam:
  172.         if down < 4:
  173.             playodds = random.randint(1, 100)
  174.             #print('playodds', playodds, 'play num', int((100 * (int(htoffense['Rushing Att']) / int(htoffense['Tot Ply'])))))
  175.             if playodds >= (int((100 * (int(htoffense['Rushing Att']) / int(htoffense['Tot Ply']))))):
  176.                 playchoice = 'passplay'
  177.             else:
  178.                 playchoice = 'runplay'
  179.         else:
  180.             if ballposition > 5300:
  181.                 playchoice = 'fieldgoalplay'
  182.             else:
  183.                 playchoice = 'puntplay'
  184.         #print(playchoice)
  185.     if possession == awayteam:
  186.         if down < 4:
  187.             playodds = random.randint(1, 100)
  188.             #print('playodds', playodds, 'play  num', int((100 * (int(atoffense['Rushing Att']) / int(atoffense['Tot Ply'])))))
  189.             if playodds >= (int((100 * (int(atoffense['Rushing Att']) / int(atoffense['Tot Ply']))))):
  190.                 playchoice = 'passplay'
  191.             else:
  192.                 playchoice = 'runplay'
  193.         else:
  194.             if ballposition > 5300:
  195.                 playchoice = 'fieldgoalplay'
  196.             else:
  197.                 playchoice = 'puntplay'
  198.         #print(playchoice)
  199.  
  200.  
  201. def passplayexecute():
  202.     global possession
  203.     global ballposition
  204.     global down
  205.     global seriesyards
  206.     global totalstats
  207.     global htstats
  208.     global atstats
  209.     global interceptionhappened
  210.     totalstats['totalpassplays'] += 1
  211.     completionchace = random.randint(1,100)
  212.     #print(possession)
  213.     interceptioncheck()
  214.     if possession == hometeam:
  215.         htstats['totalpassplays'] += 1
  216.         #print('completionchace', completionchace, 'Max Odds', 100 *(((int(htoffense['Passing Cmp']) / int(htoffense['Passing Att']))  + (int(atdefense['Passing Cmp']) / int(atdefense['Passing Att']))) / 2))
  217.         if completionchace <= int(100 * (((int(htoffense['Passing Cmp']) / int(htoffense['Passing Att']))  + (int(atdefense['Passing Cmp']) / int(atdefense['Passing Att']))) / 2)):
  218.             passcomplete = 'complete'
  219.         else:
  220.             passcomplete = 'incomplete'
  221.     if possession == awayteam:
  222.         atstats['totalpassplays'] += 1
  223.         #print('completionchace', completionchace, 'Max odds', 100 *(((int(htoffense['Passing Cmp']) / int(htoffense['Passing Att']))  + (int(atdefense['Passing Cmp']) / int(atdefense['Passing Att']))) / 2))
  224.         if completionchace <= int(100 * (((int(atoffense['Passing Cmp']) / int(atoffense['Passing Att']))  + (int(htdefense['Passing Cmp']) / int(htdefense['Passing Att']))) / 2)):
  225.             passcomplete = 'complete'
  226.         else:
  227.             passcomplete = 'incomplete'
  228.     if passcomplete == 'complete':
  229.         #print('Pass complete')
  230.         totalstats['totalcompletions'] += 1
  231.         down += 1
  232.         if possession == hometeam:
  233.             htstats['totalcompletions'] += 1
  234.             passmod = (100 * ((int(htoffense['Passing Yds']) / int(htoffense['Passing Cmp'])) + (int(atdefense['Passing Yds']) / int(atdefense['Passing Cmp']))) / 2)
  235.             #print('[passmod]', passmod)
  236.             passyards = passmod + random.uniform(-(passmod + 200), passmod + 200)
  237.             htstats['totalpassyards'] += passyards
  238.         if possession == awayteam:
  239.             atstats['totalcompletions'] += 1
  240.             passmod = (100 * ((int(atoffense['Passing Yds']) / int(atoffense['Passing Cmp'])) + (int(htdefense['Passing Yds']) / int(htdefense['Passing Cmp']))) / 2)
  241.             #print('[passmod]', passmod)
  242.             passyards = passmod + random.uniform(-(passmod + 200), passmod + 200)
  243.             atstats['totalpassyards'] += passyards
  244.         totalstats['totalpassyards'] += passyards
  245.         #print('passyards', passyards)
  246.         ballposition += passyards
  247.         seriesyards += passyards
  248.         if ballposition >= 10000:
  249.             scores[possession] += 6
  250.             extrapointexecute()
  251.             #print('passing touchdown')
  252.             #print(scores)
  253.             touchdown = 'yes'
  254.             turnover()
  255.             kickoff()
  256.         if seriesyards >= 1000:
  257.             down = 1
  258.             #print('first down', down)
  259.             seriesyards = 0
  260.             #print('ballposition', ballposition)
  261.             #print('gametime', gametime)
  262.     if passcomplete == 'incomplete':
  263.         down += 1
  264.         #print('incomplete')
  265.  
  266. def runplayexecute():
  267.     global possession
  268.     global ballposition
  269.     global down
  270.     global seriesyards
  271.     global totalstats
  272.     global htstats
  273.     global atstats
  274.     totalstats['totalrunplays'] += 1
  275.     fumblecheck()
  276.     if possession == hometeam:
  277.         htstats['totalrunplays'] += 1
  278.         runmod = ((100 * float(htoffense['Rushing YPC'])) + (100 * float(atdefense['Rushing YPC']))) / 2
  279.         #print(((htoffense['Rushing Y/A']) + (atdefense['Rushing Y/A']) / 2))
  280.         runresult = runmod + random.uniform(-(runmod + 300), (runmod + 300))
  281.         #print('runmod', runmod, 'nrundistance', nrundistance, 'runresult', runresult)
  282.         #print('runresult', runresult)
  283.         htstats['totalrushyards'] += runresult
  284.     if possession == awayteam:
  285.         atstats['totalrunplays'] += 1
  286.         runmod = ((100 * float(htoffense['Rushing YPC'])) + (100 * float(atdefense['Rushing YPC']))) / 2
  287.         #print(((htoffense['Rushing Y/A']) + (atdefense['Rushing Y/A']) / 2))
  288.         runresult = runmod + random.uniform(-(runmod + 300), (runmod + 300))
  289.         #print('runmod', runmod, 'nrundistance', nrundistance, 'runresult', runresult)
  290.         #print('runresult', runresult)
  291.         atstats['totalrushyards'] += runresult
  292.     down += 1
  293.     ballposition += runresult
  294.     seriesyards += runresult
  295.     atstats['totalrushyards'] += 1
  296.     if ballposition >= 10000:
  297.         scores[possession] += 6
  298.         extrapointexecute()
  299.         #print('rushing touchdown')
  300.         #print(scores)
  301.         turnover()
  302.         kickoff()
  303.     if seriesyards >= 1000:
  304.         down = 1
  305.         #print('first down', down)
  306.         seriesyards = 0
  307.         #print('ballposition', ballposition)
  308.     totalstats['totalrushyards'] += runresult
  309.  
  310. def puntplayexecute():
  311.     global ballposition
  312.     global possession
  313.     global ballposition
  314.     global down
  315.     global totalpuntplays
  316.     global totalpuntyards
  317.     totalstats['totalpuntplays'] += 1
  318.     puntyards = 4500 + random.randint(-2000, 2000)
  319.     totalstats['totalpuntyards'] += puntyards
  320.     #print('puntyards', puntyards)
  321.     ballposition += puntyards
  322.     if ballposition >= 10000:
  323.         ballposition = 8000
  324.     turnover()
  325.  
  326. def fieldgoalplayexecute():
  327.     global scores
  328.     global ballposition
  329.     global totalfieldgoalplays
  330.     global possession
  331.     #print('Field goal start')
  332.     #print('ballposition', ballposition)
  333.     ballposition = int(ballposition)
  334.     #print(ballposition)
  335.     totalstats['totalfieldgoalplays'] += 1
  336.     if 4000 <= ballposition <= 4999:
  337.         if possession == hometeam:
  338.             fgmod = ((float(htKicking_Punting['50 FGM']) / float(htKicking_Punting['50 FGA'])) * 100)
  339.             #print('gametime', gametime)
  340.             #print('Field Goal attempt 50+', fgmod)
  341.         if possession == awayteam:
  342.             fgmod = ((float(htKicking_Punting['50 FGM']) / float(htKicking_Punting['50 FGA'])) * 100)
  343.             #print('Field Goal attempt 50+', fgmod)
  344.             #print('gametime', gametime)
  345.     if 5000 <= ballposition <= 5999:
  346.         if possession == hometeam:
  347.             fgmod = ((float(htKicking_Punting['40-49 FGM']) / float(htKicking_Punting['40-49 FGA'])) * 100)
  348.             #print('Field Goal attempt 40-49', fgmod)
  349.             #print('gametime', gametime)
  350.         if possession == awayteam:
  351.             fgmod = ((float(htKicking_Punting['40-49 FGM']) / float(htKicking_Punting['40-49 FGA'])) * 100)
  352.             #print('Field Goal attempt 40-49', fgmod)
  353.             #print('gametime', gametime)
  354.     if 6000 <= ballposition <= 6999:
  355.         if possession == hometeam:
  356.             fgmod =((float(htKicking_Punting['30-39 FGM']) / float(htKicking_Punting['30-39 FGA'])) * 100)
  357.             #print('Field Goal attempt 30-39', fgmod)
  358.             #print('gametime', gametime)
  359.         if possession == awayteam:
  360.             fgmod = ((float(htKicking_Punting['30-39 FGM']) / float(htKicking_Punting['30-39 FGA'])) * 100)
  361.             #print('Field Goal attempt 30-39', fgmod)
  362.             #print('gametime', gametime)
  363.     if 7000 <= ballposition <= 7999:
  364.         if possession == hometeam:
  365.             fgmod = (float(htKicking_Punting['20-29 FGM']) / float(htKicking_Punting['20-29 FGA'])) * 100
  366.             #print('Field Goal attempt 20-29', fgmod)
  367.             #print('gametime', gametime)
  368.         if possession == awayteam:
  369.             fgmod = (float(htKicking_Punting['20-29 FGM']) / float(htKicking_Punting['20-29 FGA'])) * 100
  370.             #print('Field Goal attempt 20-29', fgmod)
  371.             #print('gametime', gametime)
  372.     if 8000 <= ballposition <= 10000:
  373.         fgmod = 99
  374.         #print('Field Goal attempt 0-19', fgmod)
  375.         #print('gametime', gametime)
  376.     fgchance = random.randint(0, 100)
  377.     if fgchance <= fgmod:
  378.         scores[possession] += 3
  379.         #print('fieldgoal made')
  380.         turnover()
  381.         kickoff()
  382.     else:
  383.         turnover()
  384.  
  385. def extrapointexecute():
  386.     global scores
  387.     if possession == hometeam:
  388.         xpmod = float(htKicking_Punting['Scoring XP%'])
  389.     if possession == awayteam:
  390.         xpmod = float(atKicking_Punting['Scoring XP%'])
  391.     xpchance = random.randint(0, 100)
  392.     #print('xp', xpmod, xpchance)
  393.     if xpchance <= xpmod:
  394.         scores[possession] += 1
  395.  
  396. def interceptioncheck():
  397.     global possession
  398.     global hometeam
  399.     global awayteam
  400.     global ballposition
  401.     interceptionchance = random.randint(0, 100)
  402.     if possession == hometeam:
  403.         interceptionodds = (((float(htoffense['Int']) / float(htoffense['Passing Att'])) + (float(atdefense['Passing Int']) / float(atdefense['Passing Att'])) / 2) * 100)
  404.         #print('interceptionodds', interceptionodds, 'interceptionchance', interceptionchance)
  405.         nonpossession = awayteam
  406.     if possession == awayteam:
  407.         interceptionodds = (((float(atoffense['Int']) / float(atoffense['Passing Att'])) + (float(htdefense['Passing Int']) / float(htdefense['Passing Att'])) / 2) * 100)
  408.         #print('interceptionodds', interceptionodds, 'interceptionchance', interceptionchance)
  409.         nonpossession = hometeam
  410.     if interceptionodds >= interceptionchance:
  411.         #print(' ')
  412.         #print(' ')
  413.         #print(' ')
  414.         #print(' ')
  415.         #print('Interception! ', nonpossession, ' intercepts the ball from', possession)
  416.         pick6chance = random.randint(0, 100)
  417.         if pick6chance >= 99:
  418.             #print('Interception! ', nonpossession, ' intercepts the ball from', possession)
  419.             #print('Pick 6!')
  420.             #print(scores)
  421.             scores[nonpossession] += 6
  422.             #print(scores)
  423.             #print(possession, 'posession pre turnover')
  424.             turnover()
  425.             #print(possession, 'posession post turnover')
  426.             extrapointexecute()
  427.             #print(possession, 'posession post extra point')
  428.             #print(scores)
  429.             turnover()
  430.             #print(possession, 'posession post second turnover')
  431.             kickoff()
  432.             #print(possession, 'posession post kickoff')
  433.         else:
  434.             turnover()
  435.  
  436. def fumblecheck():
  437.     global possession
  438.     global hometeam
  439.     global awayteam
  440.     global ballposition
  441.     fumblechance = random.randint(0, 100)
  442.     if possession == hometeam:
  443.         fumbleodds = (((float(htoffense['FL']) / float(htoffense['Rushing Att'])) + (float(atdefense['FL']) / float(atdefense['Rushing  Att'])) / 2) * 100)
  444.         #print('fumbleodds', fumbleodds, 'fumblechance', fumblechance)
  445.         nonpossession = awayteam
  446.     if possession == awayteam:
  447.         fumbleodds = (((float(atoffense['FL']) / float(atoffense['Rushing Att'])) + (float(htdefense['FL']) / float(htdefense['Rushing  Att'])) / 2) * 100)
  448.         #print('fumbleodds', fumbleodds, 'fumblechance', fumblechance)
  449.         nonpossession = hometeam
  450.     if fumbleodds >= fumblechance:
  451.         #print(' ')
  452.         #print(' ')
  453.         #print(' ')
  454.         #print(' ')
  455.         #print('Fumble! ', nonpossession, ' recovers the ball from', possession)
  456.         fumble6chance = random.randint(0, 100)
  457.         if fumble6chance >= 99:
  458.             #print('Fumble 6!')
  459.             #print('Fumble! ', nonpossession, ' recovers the ball from', possession)
  460.             #print(scores)
  461.             scores[nonpossession] += 6
  462.             #print(scores)
  463.             turnover()
  464.             extrapointexecute()
  465.             #print(scores)
  466.             kickoff()
  467.         else:
  468.             turnover()
  469.  
  470. def turnover():
  471.     global down
  472.     global ballposition
  473.     global possession
  474.     global seriesyards
  475.     down = 1
  476.     ballposition = abs(ballposition - 1000)
  477.     if possession == hometeam:
  478.         possession = awayteam
  479.     else:
  480.         possession = hometeam
  481.     seriesyards = 0
  482.     #print('possession', possession)
  483.     #print('ballposition', ballposition)
  484.     #print('gametime', gametime)
  485.  
  486. def executeplay():
  487.     global playchoice
  488.     global gametime
  489.     gametime -= random.uniform(.2, .6)
  490.     if playchoice == 'passplay':
  491.         passplayexecute()
  492.     if playchoice == 'runplay':
  493.         runplayexecute()
  494.     if playchoice == 'fieldgoalplay':
  495.         fieldgoalplayexecute()
  496.     if playchoice == 'puntplay':
  497.         puntplayexecute()
  498.     #print(playchoice, possession)
  499.  
  500. def game():
  501.     teamstats()
  502.     cointoss()
  503.     kickoff()
  504.     while gametime >= 30:
  505.         chooseplay()
  506.         executeplay()
  507.     halftime()
  508.     while gametime >= 0:
  509.         chooseplay()
  510.         executeplay()
  511.     #print('scores: ', scores)
  512.     #print('gametime Over')
  513.     global wins
  514.     winner = max(scores.keys(), key=(lambda k: scores[k]))
  515.     #print('winner :', winner)
  516.     global totalscores
  517.     hometeamscores = scores[hometeam]
  518.     awayteamscores = scores[awayteam]
  519.     totalscores[hometeam] += hometeamscores
  520.     totalscores[awayteam] += awayteamscores
  521.     global end
  522.  
  523. def printstats():
  524.     global totalpassplays
  525.     global totalpassyards
  526.     global totalcompletions
  527.     global end
  528.     global start
  529.     global gamesplayed
  530.     global finalscores
  531.     global matchcount
  532.     #print('Total Scores: ', totalscores)
  533.     #print('Total Yards per attempt: ', (totalstats['totalpassyards'] / totalstats['totalpassplays']) / 100)
  534.     #print('Total Average yards per completion', (totalstats['totalpassyards'] / totalstats['totalcompletions']) / 100)
  535.     #print('Total per Carry: ', (totalstats['totalrushyards'] / totalstats['totalrunplays']) / 100)
  536.     #print('Total yards per punt: ', (totalstats['totalpuntyards'] / totalstats['totalpuntplays']) / 100)
  537.     htstats['comp percent'] = 100 * (htstats['totalcompletions'] / htstats['totalpassplays'])
  538.     htstats['YP COMP'] = (htstats['totalpassyards'] / htstats['totalcompletions']) / 100
  539.     htstats['YP Carry'] = (htstats['totalrushyards'] / htstats['totalrunplays']) / 100
  540.     atstats['comp percent'] = 100 * (atstats['totalcompletions'] / atstats['totalpassplays'])
  541.     atstats['YP COMP'] = (atstats['totalpassyards'] / atstats['totalcompletions']) / 100
  542.     atstats['YP Carry'] = (atstats['totalrushyards'] / atstats['totalrunplays']) / 100
  543.     #print(hometeam, htstats)
  544.     #print(awayteam, atstats)
  545.     #print(hometeam,'completion %: ', htstats['comp percent'],' Yards Per completion: ', htstats['YP COMP'],'Yards Per Carry: ', htstats['YP Carry'] )
  546.     #print(awayteam,'completion %: ', atstats['comp percent'],' Yards Per completion: ', atstats['YP COMP'],'Yards Per Carry: ', atstats['YP Carry'] )
  547.     #print('Average scores :', hometeam, (totalscores[hometeam] / gamesplayed), awayteam, (totalscores[awayteam] / gamesplayed))
  548.     end = timer()
  549.     #print('time: ', (end - start) )
  550.     #print('')
  551.     finalscores.append(hometeam + ' : ' + str((totalscores[hometeam] / gamesplayed)) + ' | ' + awayteam + ' : ' + str((totalscores[awayteam] / gamesplayed)))
  552.  
  553.  
  554. def match():
  555.     global games
  556.     global offset
  557.     global gamesplayed
  558.     global matchcount
  559.     statsreset()
  560.     for i in range(gamesplayed):
  561.         game()
  562.         games += 1
  563.         if games >= offset:
  564.             print('Percent complete: ', int(( 100 * (offset / gamesplayed))), ' | Match Number: ', matchcount)
  565.             offset += 1000
  566.     matchcount += 1
  567.     printstats()
  568.  
  569. gamesplayed = 10000
  570. hometeam = 'Philadelphia Eagles'
  571. awayteam = 'New York Giants'
  572. match()
  573.  
  574. hometeam = 'Seattle Seahawks'
  575. awayteam = 'Oakland Raiders'
  576. match()
  577.  
  578. hometeam = 'Los Angeles Chargers'
  579. awayteam = 'Cleveland Browns'
  580. match()
  581.  
  582. hometeam = 'Tampa Bay Buccaneers'
  583. awayteam = 'Atlanta Falcons'
  584. match()
  585.  
  586. hometeam = 'Buffalo Bills'
  587. awayteam = 'Houston Texans'
  588. match()
  589.  
  590. hometeam = 'Carolina Panthers'
  591. awayteam = 'Washington Redskins'
  592. match()
  593.  
  594. hometeam = 'Baltimore Ravens'
  595. awayteam = 'Tennessee Titans'
  596. match()
  597.  
  598. hometeam = 'Kansas City Chiefs'
  599. awayteam = 'New England Patriots'
  600. match()
  601.  
  602. hometeam = 'Indianapolis Colts'
  603. awayteam = 'New York Jets'
  604. match()
  605.  
  606. hometeam = 'Chicago Bears'
  607. awayteam = 'Miami Dolphins'
  608. match()
  609.  
  610. hometeam = 'Arizona Cardinals'
  611. awayteam = 'Minnesota Vikings'
  612. match()
  613.  
  614. hometeam = 'Pittsburgh Steelers'
  615. awayteam = 'Cincinnati Bengals'
  616. match()
  617.  
  618. hometeam = 'Los Angeles Rams'
  619. awayteam = 'Denver Broncos'
  620. match()
  621.  
  622. hometeam = 'Jacksonville Jaguars'
  623. awayteam = 'Dallas Cowboys'
  624. match()
  625.  
  626. hometeam = 'San Francisco 49ers'
  627. awayteam = 'Green Bay Packers'
  628. match()
  629.  
  630. #hometeam = 'Detroit Lions'
  631. #awayteam = 'Green Bay Packers'
  632. #match()
  633. print(finalscores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement