This commit is contained in:
2025-04-28 01:42:29 -04:00
parent 189a5aef58
commit eedc80e46a
4 changed files with 62 additions and 35 deletions

View File

@@ -9,7 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
use rand::seq::SliceRandom;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use skillratings::{
elo::{elo, EloConfig, EloRating},
glicko2::{glicko2, Glicko2Rating},
Outcomes, Rating,
};
use std::num::NonZero;
@@ -136,7 +136,7 @@ pub fn run() {
pub struct PlayerArena {
/// Name, Creator Function, Elo
players: Vec<(String, AgentMaker, EloRating)>,
players: Vec<(String, AgentMaker, Glicko2Rating)>,
}
impl std::fmt::Display for PlayerArena {
@@ -162,7 +162,7 @@ impl PlayerArena {
Self {
players: players
.into_iter()
.zip([EloRating::new()].into_iter().cycle())
.zip([Default::default()].into_iter().cycle())
// flatten tuple
.map(|((a, b), c)| (a, b, c))
.collect(),
@@ -263,11 +263,11 @@ impl PlayerArena {
}
fn process_outcome(&mut self, player1: usize, player2: usize, outcome: &Outcomes) {
let (np1, np2) = elo(
let (np1, np2) = glicko2(
&self.players[player1].2,
&self.players[player2].2,
outcome,
&EloConfig { k: 10.0 },
&Default::default(),
);
self.players[player1].2 = np1;
self.players[player2].2 = np2;