pub struct EloPlayer {
pub elo: (f32, u16),
pub age: u8,
/* private fields */
}
Expand description
The player necessary for a Elo evaluation.
Fields§
§elo: (f32, u16)
§age: u8
Implementations§
source§impl EloPlayer
impl EloPlayer
sourcepub fn update_rating(&mut self, opponent_rating: f32, scored: f32)
pub fn update_rating(&mut self, opponent_rating: f32, scored: f32)
Update a player’s rating.
Arguments
opponent_ratings: Vec<f32>
- All the opponent’s ratings without the index.scored: f32
- The scored points. 1 is a win, 0.5 a draw and 0 a loss.
Examples
use lib_rapid::math::ratings::elo::player::EloPlayer;
let mut player = EloPlayer::new((2306.0, 32), 43);
player.update_rating(2077.0, 0.0);
assert_eq!(2290.0, player.elo.0.round());
Auto Trait Implementations§
impl RefUnwindSafe for EloPlayer
impl Send for EloPlayer
impl Sync for EloPlayer
impl Unpin for EloPlayer
impl UnwindSafe for EloPlayer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more