Please reccomend any functionality you think should be added!
A python library for the Elo Rating System. Right now it only supports 1 vs 1 games.
- The Elo Rating System (Elo) is a rating system used for rating players in games. Originally developed for chess by Arpad Elo, Elo has been applied to a large array of games.
- Each player is assigned a number as a rating. The system predicts the outcome of a match between two players by using an expected score formula (i.e. a player whose rating is 100 points greater than their opponent's is expected to win 64% of the time).
- Everytime a game is played, the Elo rating of the participants change depending on the outcome and the expected outcome. The winner takes points from the loser; the amount is determined by the players' scores and ratings
- A win is counts as a score of 1, loss is a score of 0, and draw is a score of 0.5
If Player A has a rating of RA and Player B a rating of RB, the exact formula for Player A's score is:
And Player B's score is:
Supposing Player A was expected to score EA points but actually scored SA points. The formula for updating his/her rating is:
Right now the K factor is found by the number of player multiplied by 42 as a constant. Working on custom K factors.
from elopy import *
i = Implementation()
i.newPlayer("Hank") #default rating is 1000
i.newPlayer("Bill",rating=900)
print i.getPlayerRating("Hank"), i.getPlayerRating("Bill")
1000 900
i.recordMatch("Hank","Bill",winner="Hank")
print i.getRatingList()
i.recordMatch("Hank","Bill",winner="Bill")
print i.getRatingList()
i.recordMatch("Hank","Bill",draw=True)
print i.getRatingList()
[('Hank', 1007.6363636363636), ('Bill', 858.0)]
[('Hank', 948.5887239540937), ('Bill', 917.04763968227)]
[('Hank', 944.7862974803486), ('Bill', 920.850066156015)]