elovate-rating
v0.1.5
Published
A JavaScript implementation of the Elo rating system
Downloads
4
Maintainers
Readme
elovate-rating
A Javascript implementation of the Elo rating system.
Installation
npm install elovate-rating --save
Usage
- Require
elovate-rating
- Use
new Rating(ratingA, ratingB, scoreA, scoreB, kfactor)
to invoke the class
Example
const Rating = require('elovate-rating');
const rating = new Rating(1500, 1500, 1, 0);
const expectedScores = rating.getExpectedScores(); // => { a: 0.5, b: 0.5 }
const newRatings = rating.getNewRatings(); // => { a: 1508, b: 1492 }
const deltaRatings = rating.getDeltaRatings(); // => { a: 8, b: -8 }
const expectedScoreA = expectedScores.a; // => 0.5
const expectedScoreB = expectedScores.b; // => 0.5
const newRatingA = newRatings.a; // => 1508
const newRatingB = newRatings.b; // => 1492
const deltaRatingA = deltaRatings.a; // => 8
const deltaRatingB = deltaRatings.b; // => -8