elo-rating-system
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Elo

elo

Implements the basic Elo rating system in TypeScript.

CircleCI Coverage Status

The Elo rating system is a method for calculating the relative skill levels of players in zero-sum games such as chess. It is named after its creator Arpad Elo, a Hungarian-American physics professor - wikipedia

npm install elo-rating-system --save

Or

yarn add elo-rating-system

Basic

JS examples

Require dependency

const Elo = require('elo');

Initialise instance:

const elo = new Elo({ k: 20, rating: 2000 }); // override the defaults!

Optional: create a helper object

const result = Object.freeze({ win: 1, loss: 0, draw: 0.5 });

.change() - rating change based on opponentRating and result

const { change } = elo.change(2200, result.win); // 15.19 ...

.probability() - decimal probability of winning vs opponentRating

const probability = elo.probability(2200); // 0.24 (or 24%)

Tests

npx jest

Todo:

  • individual results calculation
  • performance rating calculation
  • calculate automatic k-factor
  • calculate full tournament result list

Readme

Keywords

none

Package Sidebar

Install

npm i elo-rating-system

Weekly Downloads

2

Version

1.1.2

License

none

Unpacked Size

10.1 kB

Total Files

14

Last publish

Collaborators

  • mdwebb