use crate::game::Spot; /// The entries of `allowed_sizes` hero may actually use, verbatim and ascending: /// finite, positive, affordable, inside `[min_raise_to, max_raise_to]` when given. /// `None` when the spot has no `allowed_sizes` at all. pub fn valid_allowed(spot: &Spot) -> Option> { spot.allowed_sizes.as_ref().map(|sizes| { let mut usable: Vec = sizes .iter() .copied() .filter(|s| { s.is_finite() && *s > 0.0 && *s <= spot.hero_stack && spot.min_raise_to.is_none_or(|min| *s >= min) && spot.max_raise_to.is_none_or(|max| *s <= max) }) .collect(); usable.sort_by(f64::total_cmp); usable.dedup(); usable }) }