Posted by & filed under Node.js.

At work I’ve been tasked with building real-time PvP systems (pushing data from server to client) as well as matchmaking systems for pairing players together (pretty similar stuff to what I’ve been doing since first learning Node.js two years ago).

While building matchmaking systems, of course the ELO system used by Chess was brought up (As well as TrueSkill, but that’s probably patented). It’s a system which rates every player and considers the difference in ratings and the outcome of a match to determine new ratings. For example, if you’re a newbie and you’re bested by a master, it’ll only slightly affect your ratings. However, if you’re a newbie and you beat a master, it would be a large change in ratings.

I did some research on ELO modules for Node and only came across two. One was incomplete and the other was literally a file with 10 lines of code. So, I went ahead and built my own:

Arpad: An ELO Rating System for Node.js

It has unit tests and 100% code coverage. It’s also quite simple to use:

var Elo = require('arpad');

var elo = new Elo();

var alice = 1600;
var bob = 1300;

var new_alice = elo.newRatingIfWon(alice, bob);
console.log("Alice's new rating if she won:", new_alice); // 1605

Thomas Hunter II

Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.
  • Wonderfully designed library, thank you. I suggest putting documentation for `newRatingIfLost` in the GitHub readme.

  • www.guildstream.com

    Can you create me rank system for my web site. Just like this, I will need the wrights turned over to me. Please get back to me thanks,