Giter Site home page Giter Site logo

elopy's Introduction

EloPy

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.

What is the Elo Rating System?

  • 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

Calculations

If Player A has a rating of RA and Player B a rating of RB, the exact formula for Player A's score is:

alt text

And Player B's score is:

alt text

Supposing Player A was expected to score EA points but actually scored SA points. The formula for updating his/her rating is:

alt text

Right now the K factor is found by the number of player multiplied by 42 as a constant. Working on custom K factors.

Syntax when using EloPy

Creating your own implementation

from elopy import *

i = Implementation()

Adding and removing players

i.addPlayer("Hank") #default ranking is 1000
i.addPlayer("Bill",rating=900)

print i.getPlayerRating("Hank"), i.getPlayerRating("Bill")

i.removePlayer("Hank")

print i.getRatingList()
1000 900
900

Recording a match

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', 1030.2345400165577), ('Bill', 869.7654599834424)]
[('Hank', 970.1071401496504), ('Bill', 929.8928598503497)]
[('Hank', 965.2674016281943), ('Bill', 934.7325983718058)]

elopy's People

Contributors

hanksheehan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.