コード例 #1
0
def predictMatch(c,p1,p2,p3,p4,p5,p6):
    teams = []
    score = []

    rankTeams(c)

    for row in c.execute('select * from rank order by team'):
        teams.append(row[0])
        score.append(row[1])

    i1 = teams.index(p1)
    i2 = teams.index(p2)
    i3 = teams.index(p3)
    i4 = teams.index(p4)
    i5 = teams.index(p5)
    i6 = teams.index(p6)

    redScore = score[i1] + score[i2] + score[i3]
    blueScore = score[i4] + score[i5] + score[i6]

    return redScore, blueScore
コード例 #2
0
#! /usr/bin/env python

import sqlite3
import matplotlib.pyplot as plt
import pylab
from rankTeams import rankTeams
from open_db import open_db

c,conn = open_db()

rankTeams(c)

xaxis = []
count = 0
stats = []
teams = []

for t in c.execute('select team from rank'):
    xaxis.append(count)
    count += 1

for row in c.execute('select * from rank order by score desc'):

    stats.append(row[1])
    teams.append(row[0])

fig = plt.figure('ranking')
ax = fig.add_subplot(111)
ax.bar(xaxis, stats)
pylab.xticks(xaxis, teams)
fig.autofmt_xdate()