
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
toefungi-elo-calculator
Advanced tools
A package to do all necessary computations to determine ELO rankings
This package makes using the ELO ranking system easy. To get started you just need to decide what you want your starting ELO. After that, you can start calculating win probabilities based on two player's ELO scores and also determining the ELO of a player after a match.
It's very simple.
To install this package.
npm i toefungi-elo-calculator
You're first going to want to import the relevant files and instantiate a new instance of the EloCalculator
.
import { EloCalculator } from 'toefungi-elo-calculator'
const eloCalculator: EloCalculator = new EloCalculator()
Here is a basic example of calculating a new ELO value.
import { ScoringBonus } from 'toefungi-elo-calculator'
// Declared player variables
const playerElo = 2149
const opponentElo = 2084
// Calculate ELO based on the outcome of the game without taking into account
// Player performance or the score difference in the game
eloCalculator.calculateElo(playerElo, opponentElo, ScoringBonus.WIN)
.then((elo: number) => {
console.log(elo) // The new ELO
})
// Take into account the numerical difference in the score to determine the ELO
// This will make the ELO change more dynamic as it computes slightly differently
// And will more accurately split the higher players from the lower players
// In terms of their ELO
const scoreDiff = 4
eloCalculator.calculateElo(playerElo, opponentElo, ScoringBonus.WIN, scoreDiff)
.then((elo: number) => {
console.log(elo) // The new ELO
})
Here is a basic example of calculating win probabilities between two players.
import { Probabilities } from 'toefungi-elo-calculator'
// Declared player variables
const playerElo = 2149
const opponentElo = 2084
// Calculate ELO based on the outcome of the game
eloCalculator.caluclateWinProbability(playerElo, opponentElo)
.then((probability: Probabilities) => {
console.log(probability.player) // Probability player will win
console.log(probability.opponent) // Probability opponent will win
})
This package includes unit tests which cover 100% of the code and all tests are working.
The testing framework being used is mocha
and using chai-as-promised
to test the promise returns from the package.
The test suite can be run using the conventional npm test
The package uses nyc
for code coverage.
FAQs
A package to do all necessary computations to determine ELO rankings
The npm package toefungi-elo-calculator receives a total of 2 weekly downloads. As such, toefungi-elo-calculator popularity was classified as not popular.
We found that toefungi-elo-calculator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.