6 def __init__(self, global_K = 15, initial = 100, floor = 100, logdistancefactor = math.log(10)/float(400), maxlogdistance = math.log(10)):
\r
7 self.global_K = global_K
\r
8 self.initial = initial
\r
10 self.logdistancefactor = logdistancefactor
\r
11 self.maxlogdistance = maxlogdistance
\r
15 def __init__(self, fulltime, mintime, minratio, games_min, games_max, games_factor):
\r
16 self.fulltime = fulltime
\r
17 self.mintime = mintime
\r
18 self.minratio = minratio
\r
19 self.games_min = games_min
\r
20 self.games_max = games_max
\r
21 self.games_factor = games_factor
\r
23 def eval(self, mygames, mytime, matchtime):
\r
24 if mytime < self.mintime:
\r
26 if mytime < self.minratio * matchtime:
\r
28 if mytime < self.fulltime:
\r
29 k = mytime / float(self.fulltime)
\r
32 if mygames >= self.games_max:
\r
33 k *= self.games_factor
\r
34 elif mygames > self.games_min:
\r
35 k *= 1.0 - (1.0 - self.games_factor) * (mygames - self.games_min) / float(self.games_max - self.games_min)
\r
39 # parameters for K reduction
\r
40 # this may be touched even if the DB already exists
\r
41 KREDUCTION = KReduction(600, 120, 0.5, 0, 32, 0.2)
\r
43 # parameters for chess elo
\r
44 # only global_K may be touched even if the DB already exists
\r
45 # we start at K=200, and fall to K=40 over the first 20 games
\r
46 ELOPARMS = EloParms(global_K = 200)
\r