Skip to content

A Rust library to estimate iRacing iRating changes.

Notifications You must be signed in to change notification settings

Turbo87/irating-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iRacing iRating Calculator

A Rust library to estimate iRacing iRating changes.

The code in this repository is based on the iRacing SOF iRating Calculator v1_1.xlsx shared in SIMRacingApps/SIMRacingApps#209 (comment)

Usage

fn main() {
    let race_results = vec![
        ("Driver 1", 1, 3203, true).into(),
        ("Driver 2", 2, 3922, true).into(),
        ("Driver 3", 3, 2974, true).into(),
        ("Driver 4", 4, 1739, true).into(),
        ("Driver 5", 5, 1250, true).into(),
        ("Driver 6", 6, 2588, false).into(),
    ];

    let results = irating::calculate(race_results);
    for result in results {
        println!(
            "#{}  {}: {} -> {} ({}{})",
            result.race_result.finish_rank,
            result.race_result.driver,
            result.race_result.start_irating,
            result.new_irating,
            if result.irating_change > 0. { "+" } else { "" },
            result.irating_change
        );
    }
}

Output:

#1  Driver 1: 3203 -> 3280 (+76.789154)
#2  Driver 2: 3922 -> 3939 (+16.828392)
#3  Driver 3: 2974 -> 2979 (+4.8352695)
#4  Driver 4: 1739 -> 1750 (+11.098258)
#5  Driver 5: 1250 -> 1243 (-6.864749)
#6  Driver 6: 2588 -> 2485 (-102.686325)

License

This project is licensed under either of

at your option.