Crates.io | whr |
lib.rs | whr |
version | 0.2.1 |
source | src |
created_at | 2024-08-30 08:04:52.819977 |
updated_at | 2024-09-21 18:59:33.885766 |
description | Implementation of Rémi Coulom's Whole-History Rating (WHR) algorithm for Rust |
homepage | |
repository | https://github.com/aloisrtr/whr |
max_upload_size | |
id | 1357466 |
size | 31,588 |
Implementation of Rémi Coulom's Whole History Rating (WHR) algorithm as a Rust library.
It notably supports:
WHR is used to rate players in competitive games, akin to the Elo or TrueSkill systems. It can estimate the probability of winning between two players even if they have never competed against one another. It is more accurate than say the Elo system, at the cost of requiring more computation.
WHR is notably used in Go, Warcraft 3, Renju, and is even used in some sports!
I hope to generalize the library further, notably by supporting:
The library can be used in any Cargo project by running:
cargo add whr
or by adding the following to your Cargo.toml
:
[dependencies]
whr = "0.1"
The library works following the builder pattern.
use whr::WhrBuilder;
let whr = WhrBuilder::default()
.with_iterations(50) // Maximum number of iterations for the algorithm to converge.
.with_epsilon(1e-5) // Target stability between iterations
// Register games, with:
// - two named players,
// - an optional winner,
// - a timestep,
// - and optional handicap (first player advantage)
.with_game("alice", "bob", Some("bob"), 1, None)
.with_game("alice", "bob", None, 2, None)
.with_game("bob", "alice", Some("alice"), 2, None)
.build();
See the documentation for more parameters and information.