pub struct Combo {
pub cards: [Card; 2],
pub weight: f64,
}Expand description
One concrete two-card starting hand and its weight in a range.
§Examples
use native_solver::{Card, CardSet, Combo};
let card = |s: &str| s.parse::<Card>();
let combo = Combo::new(card("Kd")?, card("Ks")?, 0.5);
assert!(combo.conflicts_with(CardSet::from(card("Ks")?)));
assert!(!combo.conflicts_with(CardSet::from(card("Kh")?)));Fields§
§cards: [Card; 2]The two hole cards, in no guaranteed order.
weight: f64The combo’s weight in its range; only ratios within one range matter.
Range::combos yields weights in 0.0..=1.0; the trainer accepts
any finite, nonnegative weight.
Implementations§
Source§impl Combo
impl Combo
Sourcepub fn new(first: Card, second: Card, weight: f64) -> Self
pub fn new(first: Card, second: Card, weight: f64) -> Self
A combo of two distinct cards; their order is kept as given.
Sourcepub fn conflicts_with(&self, cards: CardSet) -> bool
pub fn conflicts_with(&self, cards: CardSet) -> bool
Whether the combo shares a card with cards.
Sourcepub fn sorted_cards(&self) -> (Card, Card)
pub fn sorted_cards(&self) -> (Card, Card)
The cards ordered low then high, so equal hands compare equal regardless of the order their cards were given in.
Trait Implementations§
impl Copy for Combo
impl StructuralPartialEq for Combo
Auto Trait Implementations§
impl Forget for Combo
impl Freeze for Combo
impl Move for Combo
impl RefUnwindSafe for Combo
impl Send for Combo
impl Sync for Combo
impl Unpin for Combo
impl UnsafeUnpin for Combo
impl UnwindSafe for Combo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more