#rating #gamedev #free #true-skill

openskill

Rust语言的OpenSkill(免费TrueSkill)实现

1个不稳定版本

0.0.1 2023年12月25日

#21 in #rating

MIT 许可证

64KB
2K SLoC

Openskill-RS

Test

描述

Rust实现Weng-Lin评分

此库基于openskill.js

安装

# TODO
cargo install openskill

使用

use openskill::prelude::*;

fn main() -> Result<(), OpenSkillError> {
    let team1 = vec![Rating::default()]; 
    let team2 = vec![Rating::new(35.0, 7.0)];

    let teams = vec![team1.clone(), team2.clone()];

    let env = Env::default(); // == EnvBuilder::default().model(ModelKind::PlackettLuce).build()
    let draw_prob = env.predict_draw(&teams)?;
    let win_rate = env.predict_win(&teams)?;
    println!("teams: {teams:?}");
    println!("draw probability: {draw_prob}, win rate: {win_rate:?}");

    let new_rate = env.rate(&GameResult::new(teams.clone(), vec![1, 2]))?;
    println!("before: {teams:?}\n after: {new_rate:?}");
    Ok(())
}

依赖

~7MB
~131K SLoC