Giter VIP home page Giter VIP logo

elo.rb's Introduction

elo.rb

A small implementation of the ELO rating system in Ruby.

Authors: Anna Sheaffer @anna2, Rishi Ghosh

A Ruby implementation of the ELO Player Rating system. The method below handles all aspects of calculating the new ELO ratings for both players. Object Oriented use supported.

newRating (Method of Match class)

  • Description: Returns an array with keys "Player1" and "Player2" holding corresponding new ELO ratings.
  • Examples: No examples yet.
  • Parmeters:
    • player1_rating: Rating of Player1 right before match.
    • player2_rating: Rating of Player2 right before match.
    • k_value: The constant K-value used in developers ELO system. Read the wikipedia article on ELO for details.
    • result: The result of the match on a scale of 0 to 1. "0" = Player1 lost, Player 2 won. "0.5" = Draw. "1" = Player 1 won, Player 2 lost.
    • should_round: Set to "true" by default. Rounds the output ratings.

Examples:

require 'elo.rb'

# Object Oriented Example
tom = RatedPlayer.new("Tom",1600)
alan = RatedPlayer.new("Alan",2000)
puts tom.rating
puts alan.rating
Match.new(tom,alan,1)
puts tom.rating
puts alan.rating
Output:
1600
2000
1629
1971

elo.rb's People

Contributors

rgho avatar

Watchers

 avatar  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.