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 passionate about technology and building products. A web design business created while attending college slowly evolved into a brick and mortar on Main St. of his small Midwestern hometown. His desire for fame and fortune led to the co-founding of a Y Combinator startup and a life in California.
Hey there! I'm currently writing a book on Microservices which I expect to release in early 2017. If you're interested in getting updates please signup here. More info about the Book
  • 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,