Enum onejoker::poker::hand_scale::Scale
source · #[repr(u8)]pub enum Scale {
Show 14 variants
None = 0,
HighHand = 1,
AceToFive = 2,
DeuceToSeven = 3,
AceToSix = 4,
Badugi = 5,
Badeucy = 6,
PaiGow = 7,
Stripped = 8,
ActionRazz = 9,
HighHandBug = 10,
AceToFiveBug = 11,
Mexican = 12,
ThreeCard = 13,
}
Expand description
wiki | Poker hand evaluation info
Enum representing hand “scales”, or ways in which poker hands are evaluated in different games.
Variants§
None = 0
None / Invalid
HighHand = 1
Traditional “high” poker hands
AceToFive = 2
Low hands, aces low, no straights or flushes
DeuceToSeven = 3
Low hands, aces low (“Kansas City” low)
AceToSix = 4
Low hands, aces high (“London” low)
Badugi = 5
Four cards, aces low, no matching suits
Badeucy = 6
Badugi, aces high
PaiGow = 7
High hands, except wheel beats K-high straight
Stripped = 8
Stripped deck: flush beats full house
ActionRazz = 9
Ace-to-five low, face card needed to qualify
HighHandBug = 10
High hands with single bug
AceToFiveBug = 11
Ace-to-five low with single bug
Mexican = 12
Spanish deck with single bug
ThreeCard = 13
Three-card high hands
Implementations§
source§impl Scale
impl Scale
sourcepub fn by_name(sname: &str) -> Scale
pub fn by_name(sname: &str) -> Scale
Get hand scale by name
use onejoker::prelude::*;
let scale = Scale::by_name("ace-to-five");
assert_eq!(scale, Scale::AceToFive);
sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Canonical name of the game or hand type
use onejoker::prelude::*;
assert_eq!(Scale::AceToFive.name(), "ace-to-five");
sourcepub const fn deck_type(&self) -> DeckType
pub const fn deck_type(&self) -> DeckType
Preferred deck for this game
use onejoker::prelude::*;
assert_eq!(DeckType::Low, Scale::AceToFive.deck_type());
sourcepub const fn complete_hand(&self) -> usize
pub const fn complete_hand(&self) -> usize
Number of cards in a complete hand
use onejoker::prelude::*;
assert_eq!(5, Scale::AceToFive.complete_hand());
sourcepub const fn low_aces(&self) -> bool
pub const fn low_aces(&self) -> bool
Calculations and comparisons expect low aces
use onejoker::prelude::*;
assert!(Scale::AceToFive.low_aces());
assert!(! Scale::DeuceToSeven.low_aces());
sourcepub const fn low_hands(&self) -> bool
pub const fn low_hands(&self) -> bool
Hand values are calculated for low hands
use onejoker::prelude::*;
assert!(Scale::AceToFive.low_hands());
assert!(Scale::DeuceToSeven.low_hands());
assert!(! Scale::HighHand.low_hands());
sourcepub const fn straights_and_flushes(&self) -> bool
pub const fn straights_and_flushes(&self) -> bool
Does the game include straights and flushes?
use onejoker::prelude::*;
assert!(Scale::HighHand.straights_and_flushes());
assert!(! Scale::AceToFive.straights_and_flushes());
sourcepub const fn high_wheel(&self) -> bool
pub const fn high_wheel(&self) -> bool
Is wheel a straight for high-ace games?
use onejoker::prelude::*;
assert!(Scale::HighHand.high_wheel());
assert!(! Scale::DeuceToSeven.high_wheel());
sourcepub const fn pai_gow_wheel(&self) -> bool
pub const fn pai_gow_wheel(&self) -> bool
Does wheel beat K-high straight?
use onejoker::prelude::*;
assert!(! Scale::HighHand.pai_gow_wheel());
assert!(Scale::PaiGow.pai_gow_wheel());
sourcepub const fn low_broadway(&self) -> bool
pub const fn low_broadway(&self) -> bool
Is Broadway a straight for low-ace games?
use onejoker::prelude::*;
// The only game that might: but I prefer this rule
assert!(! Scale::AceToSix.low_broadway());
sourcepub const fn spanish_gap(&self) -> bool
pub const fn spanish_gap(&self) -> bool
Does deck have 8s, 9s, and 10s removed?
use onejoker::prelude::*;
assert!(Scale::Mexican.spanish_gap());
sourcepub fn value_from_level(&self, hl: HandLevel) -> u32
pub fn value_from_level(&self, hl: HandLevel) -> u32
Mapping from generic hand level to numeric value
use onejoker::prelude::*;
assert_eq!(4, Scale::AceToFive.value_from_level(HandLevel::Trips));
sourcepub fn level_from_value(&self, v: u32) -> HandLevel
pub fn level_from_value(&self, v: u32) -> HandLevel
Mapping from numeric value to generic hand level
use onejoker::prelude::*;
assert_eq!(HandLevel::Trips, Scale::AceToFive.level_from_value(4));
sourcepub fn valid_card(&self, c: Card) -> bool
pub fn valid_card(&self, c: Card) -> bool
Is the given card valid for this game?
sourcepub fn valid_hand(&self, h: &Hand) -> bool
pub fn valid_hand(&self, h: &Hand) -> bool
Is this hand valid for this game?
sourcepub fn to_string(&self, d: &HandDescription) -> String
pub fn to_string(&self, d: &HandDescription) -> String
Print hand
sourcepub fn full_text(&self, d: &HandDescription) -> String
pub fn full_text(&self, d: &HandDescription) -> String
Game-specific function to get full English name of hand
use onejoker::prelude::*;
use onejoker::poker::{ojp_hh_value,ojp_hh_description};
let hand = Hand::new(DeckType::English).init(hand!("9s","As","9d","Ks","Ah"));
let v = ojp_hh_value(&hand);
let d = ojp_hh_description(&hand, v);
println!("{}", d.full_text());
println!("{}", Scale::HighHand.full_text(&d));
sourcepub fn value(&self, hand: &Hand) -> HandValue
pub fn value(&self, hand: &Hand) -> HandValue
Game-specific quick value-only hand evaluation function
use onejoker::prelude::*;
let hand = Hand::new(DeckType::English).init(hand!("9s","As","9d","Ks","Ah"));
let v = Scale::HighHand.value(&hand);
println!("{}", v);
sourcepub fn description(&self, h: &Hand, v: HandValue) -> HandDescription
pub fn description(&self, h: &Hand, v: HandValue) -> HandDescription
Get description of hand
use onejoker::prelude::*;
let hand = Hand::new(DeckType::English).init(hand!("9s","As","9d","Ks","Ah"));
let v = Scale::HighHand.value(&hand);
let d = Scale::HighHand.description(&hand, v);
println!("{}", v);
Trait Implementations§
source§impl PartialEq for Scale
impl PartialEq for Scale
impl Copy for Scale
impl Eq for Scale
impl StructuralPartialEq for Scale
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)