Incluso si no está disponible, algo como esto no es demasiado difícil de implementar. Aquí hay un ejemplo con un sistema de calificación extremadamente tonto y simple que solo tiene la intención de darle una idea. Pero no creo que usar la fórmula Elo real sea mucho más difícil.
EDITAR: edito mi implementación para usar la fórmula Elo (sin incluir pisos) dada por la fórmula aquí
def get_exp_score_a(rating_a, rating_b):
return 1.0 /(1 + 10**((rating_b - rating_a)/400.0))
def rating_adj(rating, exp_score, score, k=32):
return rating + k * (score - exp_score)
class ChessPlayer(object):
def __init__(self, name, rating):
self.rating = rating
self.name = name
def match(self, other, result):
exp_score_a = get_exp_score_a(self.rating, other.rating)
if result == self.name:
self.rating = rating_adj(self.rating, exp_score_a, 1)
other.rating = rating_adj(other.rating, 1 - exp_score_a, 0)
elif result == other.name:
self.rating = rating_adj(self.rating, exp_score_a, 0)
other.rating = rating_adj(other.rating, 1 - exp_score_a, 1)
elif result == 'Draw':
self.rating = rating_adj(self.rating, exp_score_a, 0.5)
other.rating = rating_adj(other.rating, 1 - exp_score_a, 0.5)
Esto funciona de la siguiente manera:
>>> bob = ChessPlayer('Bob', 1600)
>>> john = ChessPlayer('John', 1900)
>>> bob.rating
1600
>>> john.rating
1900
>>> bob.match(john, 'Bob')
>>> bob.rating
1627.1686541692377
>>> john.rating
1872.8313458307623
>>> mark = ChessPlayer('Mark', 2100)
>>> mark.match(bob, 'Draw')
>>> mark.rating
2085.974306956907
>>> bob.rating
1641.1943472123305
Aquí está mi implementación original de Python:
class ChessPlayer(object):
def __init__(self, name, rating):
self.rating = rating
self.name = name
def match(self, other, result):
if result == self.name:
self.rating += 10
other.rating -= 10
elif result == other.name:
self.rating += 10
other.rating -= 10
elif result == 'Draw':
pass
Esto funciona de la siguiente manera:
>>> bob = ChessPlayer('Bob', 1600)
>>> john = ChessPlayer('John', 1900)
>>> bob.match(john, 'Bob')
>>> bob.rating
1610
>>> john.rating
1890
>>> mark = ChessPlayer('Mark', 2100)
>>> mark.match(bob, 'Mark')
>>> mark.rating
2110
>>> bob.rating
1600
>>> mark.match(john, 'Draw')
>>> mark.rating
2110
>>> john.rating
1890