def populate_schedule_with_teams(schedule):
  sched_with_teams = []
  team_dict = {}
  with open("kenpom.csv", "rb") as csvfile:
    kenpomdata = csv.reader(csvfile)
    kenpomdata.next()
    #make every team in Division I
    for d in kenpomdata:
      team_key = d[0]
      team_dict[team_key] = Team(team_key)
      team_dict[team_key].offense = float(d[7])
      team_dict[team_key].defense = float(d[11])
  print team_dict
  for game in schedule:
    opponent = team_dict[game[0]]
    location = game[1]
    g = (opponent, location)
    sched_with_teams.append(g)
  return sched_with_teams
from gamesim import gamesim, neutralsim
from simutil import Team
import csv

"""The purpose of this program is to sim a single team through a 
fictional schedule for a large sample of times to figure out the
percentage chance of a certain likelihood of wins and losses."""

#The team you'll be simulating games for
key_team = Team("Kansas")
with open("kenpom.csv", "rb") as csvfile:
  kenpomdata = csv.reader(csvfile)
  #find your key team and populate its offense and defense
  for d in kenpomdata:
    if d[0] == key_team.name:
      key_team.offense = float(d[7])
      key_team.defense = float(d[11])
#The games you'll be simulating, with Team Name and Site
schedule = [("Western Kentucky", "H"), ("William & Mary", "N"), ("Tennessee St.", "H"),
            ("Tulsa", "A"), ("DePaul", "N"), ("BYU", "N"),
            ("Saint Louis", "A"), ("Oral Roberts", "H"), ("Tennessee", "H"), 
            ("Alabama", "A"), ("North Carolina Central", "H"), ("Davidson", "H"),
            ("Southern Illinois", "A"), ("Northern Iowa", "H"), ("Illinois St.", "H"),
            ("Missouri St.", "A"), ("Bradley", "H"), ("Indiana St.", "H"), 
            ("Illinois St.", "A"), ("Drake", "A"), ("Loyola Chicago", "H"), 
            ("Evansville", "H"), ("Indiana St.", "A"), ("Northern Iowa", "A"), 
            ("Southern Illinois", "H"), ("Evansville", "A"), ("Loyola Chicago", "A")]

# schedule = [("Louisiana Monroe", "H"), ("Duke", "N"), ("Iona", "H"),
#             ("Towson", "H"), ("Wake Forest", "N"), ("Villanova", "N"),
#             ("UTEP", "N"), ("Colorado", "A"), ("Florida", "A"),