use pickleball_elo::glicko::{GlickoRating, Glicko2Calculator, calculate_weighted_score};

fn main() {
    println!("🏓 Glicko-2 Simple Test\n");
    
    let calc = Glicko2Calculator::new();
    
    // Test 1: Single match between equal players
    println!("Test 1: Equal players, one wins 11-5");
    let player = GlickoRating::new_player();
    let opponent = GlickoRating::new_player();
    
    println!("  Before: Player {:.1} (RD: {:.1})", player.rating, player.rd);
    println!("  Before: Opponent {:.1} (RD: {:.1})\n", opponent.rating, opponent.rd);
    
    let outcome = calculate_weighted_score(1.0, 11, 5);
    println!("  Weighted outcome: {:.3}", outcome);
    
    let new_rating = calc.update_rating(&player, &[(opponent, outcome)]);
    
    println!("  After: Player {:.1} (RD: {:.1}, σ: {:.4})", 
             new_rating.rating, new_rating.rd, new_rating.volatility);
    println!("  Change: {:+.1}\n", new_rating.rating - player.rating);
    
    // Test 2: Close game vs blowout
    println!("Test 2: Close win (11-9) vs Blowout (11-2)");
    let close_outcome = calculate_weighted_score(1.0, 11, 9);
    let blowout_outcome = calculate_weighted_score(1.0, 11, 2);
    
    println!("  Close (11-9): weighted score = {:.3}", close_outcome);
    println!("  Blowout (11-2): weighted score = {:.3}", blowout_outcome);
    
    let close_new = calc.update_rating(&player, &[(opponent, close_outcome)]);
    let blowout_new = calc.update_rating(&player, &[(opponent, blowout_outcome)]);
    
    println!("  Close win rating change: {:+.1}", close_new.rating - player.rating);
    println!("  Blowout win rating change: {:+.1}\n", blowout_new.rating - player.rating);
    
    println!("✅ All tests complete!");
}
