# new_dict = dict(zip(m.values(), m.keys())) # sorted_arr = sorted(new_dict.keys()) # for n in reversed(sorted_arr): # print names[new_dict[n]] + " " + str(n) mad = open("madresults.txt", "r") curseason = "0" curInd = -1 correct = 0 wrong = 0 correctAvg = 0.0 overCorrect = 0 wrongAvg = 0.0 lowestWrong = 0.0 curSe = seasons[0] s = pr.rank(curSe) winsPredict = dict() countPredict = dict() count = 0 rest = 0 restWins = 0 for res in mad: gam = res.split("\t") if curseason is not gam[0]: curseason = gam[0] curInd += 1 curSe = seasons[curInd] s = pr.rank(curSe) overCorrect += correct # if curInd is not 0: # print 'The average for wins in season ' + str(curInd + 1995) + ' is ' + str(correctAvg/correct) + ' with ' + str(correct) + ' correct. Wrong is ' + str(wrongAvg/wrong) + ' with ' + str(wrong) + ' wrong and a low of ' + str(lowestWrong) + '. correct percentage is ' + str(float(correct)/(correct + wrong))
from copy import deepcopy names = dict() e = open('teamname.txt', 'r') for name in e: sp = name.split('\t') names[sp[0]] = sp[1][0:len(sp[1])-1] f = open('2014se.txt', 'r') seasons = [] seas = dict() #team, score for line in f: gam = line.split('\t') if gam[2] in seas: team1 = seas[gam[2]] else: team1 = Team(names[gam[2]]) if gam[4] in seas: team2 = seas[gam[4]] else: team2 = Team(names[gam[4]]) team1.addGame(Game(gam[4], gam[3], gam[5])) team2.addGame(Game(gam[2], gam[5], gam[3])) seas[gam[2]] = deepcopy(team1) seas[gam[4]] = deepcopy(team2) seasons.append(deepcopy(seas)) j = seas pr = PageRank() m = pr.rank(j) for team in j.keys(): print names[team] + '\t' + str(m[team]*169.6 + j[team].getScores()[0]*0.0701)