コード例 #1
0
def match_result(teams):
		weights=get_weights()
		weights_0=weights[teams[0]]
		weights_1=weights[teams[1]]
		#call result from poss and get the result
		#print "%s V %s: " %(teams[0],teams[1]),
		return poss.result(weights_0[0]*weights_1[1],weights_1[0]*weights_0[1])
コード例 #2
0
def match_result(teams):
    weights = get_weights()
    weights_0 = weights[teams[0]]
    weights_1 = weights[teams[1]]
    #call result from poss and get the result
    #print "%s V %s: " %(teams[0],teams[1]),
    return poss.result(2.3 * weights_0[0] * weights_1[1],
                       2.3 * weights_1[0] * weights_0[1])
コード例 #3
0
import poss

mean1=1.33*0.8*2.3
mean2=1.2*0.667*2.3


print poss.result(mean1,mean2)
コード例 #4
0
#print sys.argv[1]
#fixtures=open("fixtures.data")
fixtures = open(sys.argv[1])
weights_data = open("final_data")

weights = []
weight = [0, 0, 0]
#store the weights in memory
for i in weights_data:
    items = i.split()
    weight = [string.lower(items[0]), float(items[-2]), float(items[-1])]
    weights.append(weight)

weights_0 = [9, 9]
weights_1 = [9, 9]
for match in fixtures:
    teams = match.split()
    #get weights for these teams
    for item in weights:
        if item[0] == string.lower(teams[0]):
            weights_0 = [item[1], item[2]]
        if item[0] == string.lower(teams[1]):
            weights_1 = [item[1], item[2]]
    if weights_0[0] == 9:
        print "%s weights not found" % teams[0]
    if weights_1[0] == 9:
        print "%s weights not found" % teams[1]
    #call result from poss and get the result
    print "%s V %s: " % (teams[0], teams[1]),
    print poss.result(weights_0[0] * weights_1[1], weights_1[0] * weights_0[1])
コード例 #5
0
ファイル: match.py プロジェクト: cathcart/Cool-code-scraps
import poss
in_file=open("06_weights")


records=[]
record=[0,0,0]
for i in in_file:
	items=i.split()
	record=[items[0],float(items[1]),float(items[2])]
	records.append(record)

team1="ENGLAND"
team2="USA"

required1=[0,0]
for i in records:
	if i[0]==team1:
		required1=[i[1],i[2]]
	if i[0]==team2:
		required2=[i[1],i[2]]


print "In the match of %s against %s, we find the result to be: " %(team1,team2)
print poss.result(required1[0]*required2[1],required2[0]*required1[1])
コード例 #6
0
ファイル: round1.py プロジェクト: cathcart/Cool-code-scraps
fixtures=open(sys.argv[1])
weights_data=open("final_data")

weights=[]
weight=[0,0,0]
#store the weights in memory
for i in weights_data:
	items=i.split()
	weight=[string.lower(items[0]),float(items[-2]),float(items[-1])]
	weights.append(weight)

weights_0=[9,9]
weights_1=[9,9]
for match in fixtures:
	teams=match.split()
	#get weights for these teams
	for item in weights:
		if item[0]==string.lower(teams[0]):
			weights_0=[item[1],item[2]]
		if item[0]==string.lower(teams[1]):
			weights_1=[item[1],item[2]]
	if weights_0[0]==9:
		print "%s weights not found"%teams[0]
	if weights_1[0]==9:
		print "%s weights not found"%teams[1]
	#call result from poss and get the result
	print "%s V %s: " %(teams[0],teams[1]),
	print poss.result(weights_0[0]*weights_1[1],weights_1[0]*weights_0[1])

	
コード例 #7
0
ファイル: round1.py プロジェクト: cathcart/Cool-code-scraps
fixtures=open(sys.argv[1])
weights_data=open("data")

weights=[]
weight=[0,0,0]
#store the weights in memory
for i in weights_data:
	items=i.split()
	weight=[string.lower(items[0]),float(items[-2]),float(items[-1])]
	weights.append(weight)

weights_0=[9,9]
weights_1=[9,9]
for match in fixtures:
	teams=match.split()
	#get weights for these teams
	for item in weights:
		if item[0]==string.lower(teams[0]):
			weights_0=[item[1],item[2]]
		if item[0]==string.lower(teams[1]):
			weights_1=[item[1],item[2]]
	if weights_0[0]==9:
		print "%s weights not found"%teams[0]
	if weights_1[0]==9:
		print "%s weights not found"%teams[1]
	#call result from poss and get the result
	print "%s V %s: " %(teams[0],teams[1]),
	print poss.result(2.3*weights_0[0]*weights_1[1],2.3*weights_1[0]*weights_0[1])