- Created new ELO module (src/elo/) with: - Simple rating-only system (no RD or volatility tracking) - Standard ELO expected score calculation - Per-point performance scoring - Effective opponent formula for doubles - Full test suite (21 tests, all passing) - Updated main.rs to use ELO calculator: - Per-point scoring: performance = points_scored / total_points - Effective opponent in doubles: Opp1 + Opp2 - Teammate - K-factor = 32 for casual play - Created analysis tool (src/bin/elo_analysis.rs): - Reads match history from database - Recalculates all ratings using pure ELO - Generates before/after comparison (JSON + Markdown) - Updated documentation: - New LaTeX report (rating-system-v3-elo.tex) - Simplified explanations (no volatility/RD complexity) - Plain English examples and use cases - FAQ section - All tests passing (21/21 ELO tests) - Code compiles without errors - Release build successful
37 lines
772 B
Rust
37 lines
772 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// Simple ELO rating without deviation or volatility
|
|
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
|
pub struct EloRating {
|
|
pub rating: f64, // Display scale (e.g., 1500)
|
|
}
|
|
|
|
impl EloRating {
|
|
pub fn new_player() -> Self {
|
|
Self {
|
|
rating: 1500.0,
|
|
}
|
|
}
|
|
|
|
pub fn new_with_rating(rating: f64) -> Self {
|
|
Self { rating }
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn test_new_player() {
|
|
let rating = EloRating::new_player();
|
|
assert_eq!(rating.rating, 1500.0);
|
|
}
|
|
|
|
#[test]
|
|
fn test_new_with_rating() {
|
|
let rating = EloRating::new_with_rating(1600.0);
|
|
assert_eq!(rating.rating, 1600.0);
|
|
}
|
|
}
|