use crate::read::draw::Draw; use crate::read::hand_read::HandRead; use crate::read::made::Made; use crate::read::suit_pattern::SuitPattern; /// Wetness from which a board is called wet, and up to which it is called dry. const WET: f64 = 0.6; const DRY: f64 = 0.3; fn made_name(made: Made) -> &'static str { match made { Made::Air => "air", Made::BoardOnly => "board only", Made::Underpair => "underpair", Made::BottomPair => "bottom pair", Made::MiddlePair => "middle pair", Made::TopPairWeakKicker => "top pair weak kicker", Made::TopPairGoodKicker => "top pair good kicker", Made::Overpair => "overpair", Made::TwoPair => "two pair", Made::Set => "set", Made::Trips => "trips", Made::Straight => "straight", Made::Flush => "flush", Made::FullHouse => "full house", Made::Quads => "quads", Made::StraightFlush => "straight flush", } } fn draw_suffix(draw: Draw) -> &'static str { match draw { Draw::None | Draw::Backdoor => "", Draw::Gutshot => " with gutshot", Draw::OpenEnded => " with open-ended draw", Draw::Flush => " with flush draw", Draw::Combo => " with combo draw", } } fn board_name(read: &HandRead) -> &'static str { let wetness = read.texture.wetness; if read.texture.suits == SuitPattern::FourFlush { "four-flush" } else if wetness >= WET { "wet" } else if wetness <= DRY { "dry" } else { "medium" } } /// The read in words, e.g. "top pair good kicker on wet board" or /// "air with flush draw on dry board". Used in decision reasons. pub fn describe(read: &HandRead) -> String { format!("{}{} on {} board", made_name(read.made), draw_suffix(read.draw), board_name(read)) }