Files
pokerfreak/src/hand/strength.rs
T

21 lines
814 B
Rust

use super::category::Category;
use super::ranking_order::place;
use crate::variant::HandRanking;
/// Totally ordered hand value: the category's place in the variant's ladder first
/// (`order`), then the tie-break ranks (pip values, most significant first; unused slots are 0).
/// Equal strengths are split pots. Strengths of different rankings must not be compared.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Strength {
/// Place of `category` under the ranking this value was made with (derived order starts here).
pub order: u8,
pub category: Category,
pub ranks: [u8; 5],
}
impl Strength {
pub fn new(ranking: HandRanking, category: Category, ranks: [u8; 5]) -> Strength {
Strength { order: place(ranking, category), category, ranks }
}
}