-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscoremaker.py
More file actions
executable file
·26 lines (21 loc) · 835 Bytes
/
scoremaker.py
File metadata and controls
executable file
·26 lines (21 loc) · 835 Bytes
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
#!/bin/env python
import random, redis
teams = ['ARG','BWS','BWS2','BGR','BRK','BSG','CLF','CLF2','EMM','GRS','GMR','HRS','HZW','MFG','MUC','PSC','PSC2','QEH','QMC','SEN','SEN2','TTN']
actor = redis.Redis(host='localhost',port=6379,db=0)
def game_points(score):
total = 0
total += int(score[2])
total += 2*int(score[3])
total += 5*int(score[4])
if int(score[5]) > 1:
total *= int(score[5])
return total
for i in range(21):
for j in range(4):
r = int(random.random()*10)
z = int(random.random()*10)
b = int(random.random()*10)
n = int(random.random()*10)%5
s = game_points([0,0,r,z,b,n])
actor.hmset('org.srobo.scores.match.{0}.{1}'.format(i,j),{'trobot':r,'tzone':z,'tbucket':b,'nbuckets':n})
actor.incr('org.srobo.scores.team.{0}'.format(teams[i]),s)