PickleBALLER/test_simple.rs

28 lines
1015 B
Rust
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use pickleball_elo::glicko::{GlickoRating, Glicko2Calculator, calculate_weighted_score};
fn main() {
println!("Testing Glicko-2 Calculator...\n");
let calc = Glicko2Calculator::new();
let player = GlickoRating::new_player();
let opponent = GlickoRating::new_player();
println!("Initial ratings:");
println!(" Player: {:.1} (RD: {:.1})", player.rating, player.rd);
println!(" Opponent: {:.1} (RD: {:.1})\n", opponent.rating, opponent.rd);
// Player wins 11-5
let outcome = calculate_weighted_score(1.0, 11, 5);
println!("Match: Player wins 11-5");
println!("Weighted outcome: {:.3}\n", outcome);
let new_rating = calc.update_rating(&player, &[(opponent, outcome)]);
println!("Updated rating:");
println!(" Player: {:.1} (RD: {:.1}, σ: {:.4})",
new_rating.rating, new_rating.rd, new_rating.volatility);
println!(" Change: {:+.1}", new_rating.rating - player.rating);
println!("\n✅ Test complete!");
}