Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

ELO-Ratings for your django models

Project description

Django ELO Rating

Installation

python3 -m pip install --user --upgrade django_elo_rating

Configuation

In your settings.py add the following lines

ELO_START_VALUE = 1000
ELO_FACTOR_K = 30

Usage

from django_elo_rating import EloRated


class Player(EloRated):
    pass


player_1 = Player()
player_2 = Player()

print(player_1.elo_rating)
# 1000 or whatever you set as ELO_START_VALUE
print(player_2.elo_rating)
# 1000 or whatever you set as ELO_START_VALUE

probability_player_1_wins = player_1.probability(player_2)
print(probability_player_1_wins)
# 0.5

# If player_1 wins a game against player_2 
# update player_1's elo rating like this
player_1.elo_rating = player_1.updated_elo(player_2, 1)
# and player_2's like this 
player_2.elo_rating = player_2.updated_elo(player_1, 0)


# If they played a draw
player_1.elo_rating = player_1.updated_elo(player_2, 0.5)
player_2.elo_rating = player_2.updated_elo(player_1, 0.5)

Project details


Release history Release notifications

This version

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-elo-rating, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_elo_rating-0.0.1-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size django_elo_rating-0.0.1.tar.gz (1.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page