Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arpad

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arpad

An implementation of the ELO Rating System

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Arpad: ELO Rating System for Node.js

Build Status

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.

Installation

npm install arpad

Simple Usage

This is a fairly simple example showing the most common usage for Arpad:

const Elo = require('arpad');

const elo = new Elo();

let alice = 1600;
let bob = 1300;

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

let new_bob = elo.newRatingIfWon(bob, alice);
console.log("Bob's new rating if he won:", new_bob); // 1327

Complex Usage

This is a more complex example, making use of K-factor tables and score values:

const Elo = require('arpad');

const uscf = {
  default: 32,
  2100: 24,
  2400: 16
};

const min_score = 100;
const max_score = 10000;

const elo = new Elo(uscf, min_score, max_score);

let alice = 2090;
let bob = 2700;

let odds_alice_wins = elo.expectedScore(alice, bob);
console.log("The odds of Alice winning are about:", odds_alice_wins); // ~2.9%
alice = elo.newRating(odds_alice_wins, 1.0, alice);
console.log("Alice's new rating after she won:", alice); // 2121

odds_alice_wins = elo.expectedScore(alice, bob);
console.log("The odds of Alice winning again are about:", odds_alice_wins); // ~3.4%
alice = elo.newRating(odds_alice_wins, 1.0, alice);
console.log("Alice's new rating if she won again:", alice); // 2144

Running Tests

If 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 test

License

MIT

Keywords

FAQs

Package last updated on 13 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc