pub struct PQLHiRating(/* private fields */);Expand description
Hand Ranking
§Overview
this is used for holdem omaha and shortdeck there are 10 hand types:
RoyalFlushStraigtFlushQuadsFullHouseFlushStraightTripsTwoPairPairHighCard
with some variations of shortdeck the order of handtype can vary:
- FFH
- Flush >
FullHouse> Straight > Trips
- Flush >
- TS
- Flush >
FullHouse> Trips > Straight
- Flush >
§Rank representation:
- Rank as index value
- 0b0000 is Duece and 0b1100 is Ace
- Combination of two ranks
- nCr(13, 2) is 78 so the index of combination can be fitted in 7 bits
- Combination of three ranks
- nCr(13, 3) is 286 so the index of combination can be fitted in 9 bits
- Combination of five ranks
- we just use the 13 bit flags
§Memory Layout:
positive i16 values:
`RoyalFlush`/`StraightFlush`
[15, 0]: 011ssss0 00000000 // s: rank of highest card
`Quads`:
[15, 0]: 01100000 qqqqkkkk // q: rank of quads; k: rank of kicker
`FullHouse`:
[15, 0]: 01000000 ttttpppp // q: rank of trips; k: rank of pair
`Flush`:
[15, 0]: 001rrrrr rrrrrrrr // r: set bit of 5 cards and zeros of the rest
`Straight`:
[15, 0]: 000ssss0 00000000 // s: rank of highest card
negative i16 values:
`Trips`:
[15, 0]: 1110tttt 0kkkkkkk // t: rank of trips; k: index of combination
`TwoPair`:
[15, 0]: 11000ppp ppppkkkk // p: index of combination; k: rank of kicker
`Pair`:
[15, 0]: 101ppppk kkkkkkkk // p: rank of pair; k: index of combination
`HighCard`:
[15, 0]: 100rrrrr rrrrrrrr // r: bit flags of 5 cardsImplementations§
Source§impl PQLHiRating
impl PQLHiRating
pub const MAX: Self
pub const MIN: Self
pub const fn new(i: HandRatingInt) -> Self
pub const fn to_i16(self) -> i16
pub fn to_hand_type(self, game: PQLGame) -> PQLHandType
pub fn to_hand_type_and_low_high_ranks( self, game: PQLGame, ) -> (PQLHandType, PQLRankSet, PQLRankSet)
Trait Implementations§
Source§impl Clone for PQLHiRating
impl Clone for PQLHiRating
Source§fn clone(&self) -> PQLHiRating
fn clone(&self) -> PQLHiRating
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PQLHiRating
impl Debug for PQLHiRating
Source§impl Default for PQLHiRating
impl Default for PQLHiRating
Source§impl From<PQLHiRating> for VmStackValue
impl From<PQLHiRating> for VmStackValue
Source§fn from(value: PQLHiRating) -> Self
fn from(value: PQLHiRating) -> Self
Converts to this type from the input type.
Source§impl Ord for PQLHiRating
impl Ord for PQLHiRating
Source§fn cmp(&self, other: &PQLHiRating) -> Ordering
fn cmp(&self, other: &PQLHiRating) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PQLHiRating
impl PartialEq for PQLHiRating
Source§impl PartialOrd for PQLHiRating
impl PartialOrd for PQLHiRating
Source§impl<'a> TryFrom<&'a VmValue> for &'a PQLHiRating
impl<'a> TryFrom<&'a VmValue> for &'a PQLHiRating
Source§impl<'a> TryFrom<&'a mut VmValue> for &'a mut PQLHiRating
impl<'a> TryFrom<&'a mut VmValue> for &'a mut PQLHiRating
Source§impl TryFrom<VmStackValue> for PQLHiRating
impl TryFrom<VmStackValue> for PQLHiRating
Source§type Error = TryIntoError<VmStackValue>
type Error = TryIntoError<VmStackValue>
The type returned in the event of a conversion error.
Source§fn try_from(value: VmStackValue) -> Result<Self, TryIntoError<VmStackValue>>
fn try_from(value: VmStackValue) -> Result<Self, TryIntoError<VmStackValue>>
Performs the conversion.
impl Copy for PQLHiRating
impl Eq for PQLHiRating
impl StructuralPartialEq for PQLHiRating
Auto Trait Implementations§
impl Freeze for PQLHiRating
impl RefUnwindSafe for PQLHiRating
impl Send for PQLHiRating
impl Sync for PQLHiRating
impl Unpin for PQLHiRating
impl UnwindSafe for PQLHiRating
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