Implements the basic Elo rating system in TypeScript.
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
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%)
npx jest
Todo:
- individual results calculation
- performance rating calculation
- calculate automatic k-factor
- calculate full tournament result list