-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhouston.py
executable file
·43 lines (33 loc) · 991 Bytes
/
houston.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
from cutoff import parse_file,none_to_0,seconds
def rp_parse_line(s):
#str->(int,int)
sp=s.split()
assert len(sp)==2
return int(sp[0]),int(sp[1])
def rp_parse_file():
#returns [(int,int)]
return map(rp_parse_line,open('data/pts_64.txt','r').read().splitlines())
def rank_to_get_points(points):
#int->either int or str
r=rp_parse_file()
point_values=seconds(r)
#if points<=min(point_values):
# return 'any'
for x in reversed(r):
rank=x[0]
if rank<=8:
points_here=x[1]+(17-rank)
else:
points_here=x[1]
if points<=points_here:
return rank
if __name__=='__main__':
cutoff=134
p=filter(lambda x: x['district_championship'],parse_file('data/2018_mar31_pnw.txt'))
for a in p:
total_points=none_to_0(a['event1'])+none_to_0(a['event2'])+a['team_age_points']
normal_points_left=(cutoff-total_points)/3.0
r=rank_to_get_points(normal_points_left)
#print '%s\t%s\t%s'%(r,normal_points_left,a['team'])
print '%s\t%s'%(r,a['team'])