This is an implementation of ELO for Node.js (ELO is named after Arpad Elo, hence the package name). This module is heavily tested and has many features used in real-world ELO situations.
$ npm install arpadThis is a fairly simple example showing the most common usage for Arpad:
constElo=require('arpad');constelo=newElo();letalice=1_600;letbob=1_300;letnew_alice=elo.newRatingIfWon(alice,bob);console.log("Alice's new rating if she won:",new_alice);// 1,605letnew_bob=elo.newRatingIfWon(bob,alice);console.log("Bob's new rating if he won:",new_bob);// 1,327This is a more complex example, making use of K-factor tables and score values:
constElo=require('arpad');constuscf={default: 32,2100: 24,2400: 16};constmin_score=100;constmax_score=10_000;constelo=newElo(uscf,min_score,max_score);letalice=2_090;letbob=2_700;letodds_alice_wins=elo.expectedScore(alice,bob);console.log("The odds of Alice winning are about:",odds_alice_wins);// 0.029alice=elo.newRating(odds_alice_wins,1.0,alice);console.log("Alice's new rating after she won:",alice);// 2121odds_alice_wins=elo.expectedScore(alice,bob);console.log("The odds of Alice winning again are about:",odds_alice_wins);// 0.034alice=elo.newRating(odds_alice_wins,1.0,alice);console.log("Alice's new rating if she won again:",alice);// 2144If you'd like to contribute be sure to run npm install to get the required packages and then make changes.
Afterwards simply run the tests.
If everything passes your Pull Request should be ready.
$ npm testMIT