multi-elo
v2.3.1
Published
[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![bundle][bundle-src]][bundle-href] [![Codecov][codecov-src]][codecov-href]
Downloads
132
Readme
multi-elo
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.