rating

Crates.iorating
lib.rsrating
version0.1.0
created_at2023-03-03 02:27:39.89737+00
updated_at2023-03-03 03:16:44.866355+00
descriptionA library that implements multiple rating systems and utilities for multiplayer games
homepage
repositoryhttps://github.com/bitten-cookie/rating
max_upload_size
id799364
size24,358
Miguel Cunha (promgamer)

documentation

README

Rating

Crates.io docs.rs License

This library provides an easy and type-safe way to maintain player's ratings.

Example

use rating::{CalculateRating, EloStrategy, GameResult, Rating};

fn main() {
    let alice = Rating::from(1200);
    let bob = Rating::from(1453);

    let elo_calculator = EloStrategy::new(40);
    // the game result it's seen from the first player perspective, in this case Alice
    let (alice_new_rating, bob_new_rating) = elo_calculator.calculate(alice, bob, GameResult::Win);

    println!("Alice: {alice_new_rating}");
    println!("Bob: {bob_new_rating}");

    // Alice: 1232.4
    // Bob: 1420.6
}

Details

Currently, it only implements the classical Elo rating system, widely used in the chess community.

Commit count: 7

cargo fmt