Skip to content

This package implements a multiplayer extension of the popular Elo rating system.

License

Notifications You must be signed in to change notification settings

SlyTrunk/multi-elo

 
 

Repository files navigation

multi-elo

npm version npm downloads bundle Codecov

This package implements a multiplayer extension of the popular Elo rating system.

This Package is based on djcunningham0s python implementation. For additional information, see his blog post on Towards Data Science (or try this link if you hit a paywall).

Installation

The package can be installed from GitHub or npm by using npm.

# npm
npm install multi-elo

# yarn
yarn add multi-elo

# pnpm
pnpm install multi-elo

# bun
bun install multi-elo

Import:

// ESM
import {} from "multi-elo";

// CommonJS
const {} = require("multi-elo");

Example Usage

The following example shows how to calculate updated Elo ratings after a matchup using the default settings in the package.

import { MultiElo } from 'multi-elo';

# player with 1200 rating beats a player with 1000 rating
MultiElo.getNewRatings([1200, 1000])
# [1207.68809835,  992.31190165]

# player with 900 rating beats player with 1000 rating
MultiElo.getNewRatings([900, 1000])
# [920.48207999, 979.51792001]

# 3-way matchup
MultiElo.getNewRatings([1200, 900, 1000])
#  [1208.34629612,  910.43382278,  981.21988111]

See demo.md for a more in-depth tutorial, including details on parameters that can be tuned in the Elo algorithm.

Methodology

For more Info on the methodology read djcunningham0s Readme.

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛 by Samuel Höra

Published under MIT License.

About

This package implements a multiplayer extension of the popular Elo rating system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%