1.1.2 • Published 1 year ago

elo-rating-system v1.1.2

Weekly downloads
8
License
-
Repository
-
Last release
1 year ago

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
1.1.1

2 years ago

1.1.2

1 year ago

1.1.0

4 years ago

1.0.0

4 years ago