pub struct RegularWait {
pub pair: Option<Tile>,
pub waiting_kind: WaitingKind,
pub pattern_tile: Tile,
pub waiting_tile: Tile,
/* private fields */
}Expand description
A regular waiting pattern and hand decomposition of a waiting hand.
For a regular 3N+1 hand, this includes:
- Exactly
Nhand groups, including at most one incomplete (waiting) hand group. The complete hand groups can be iterated usingRegularWait::groups(). - A complete pair (雀頭) or a Tanki (単騎) waiting pattern (= incomplete pair).
Note that there is exactly one waiting pattern, either a Tanki or an incomplete group.
§Optional serde support
Custom format, serialization only. Example:
{
"groups": [
{"type": "Koutsu", "tile": "1m"},
{"type": "Koutsu", "tile": "2m"},
{"type": "Shuntsu", "tile": "7m"}
],
"pair": "6z",
"kind": "Shanpon",
"pattern": "7z",
"waiting": "7z"
}Fields§
§pair: Option<Tile>The complete pair (excluding Tanki).
waiting_kind: WaitingKindThe detailed kind of the waiting pattern.
pattern_tile: TileThe smallest tile in the waiting pattern.
Examples:
- 12m wait 3m => 1m
- 34m wait 2m => 3m
- 79p wait 8p => 7p
- 3s wait 3s => 3s
waiting_tile: TileThe waiting tile (duh).
Implementations§
Source§impl RegularWait
impl RegularWait
Sourcepub fn groups(&self) -> impl Iterator<Item = HandGroup>
pub fn groups(&self) -> impl Iterator<Item = HandGroup>
Iterate all complete groups in this hand decomposition.
Sourcepub fn has_pair_or_tanki(&self) -> bool
pub fn has_pair_or_tanki(&self) -> bool
Returns whether this waiting pattern has a pair (complete or incomplete).
Sourcepub fn pair_or_tanki(&self) -> Option<Tile>
pub fn pair_or_tanki(&self) -> Option<Tile>
Returns the tile of the pair (complete or incomplete).
Sourcepub fn is_true_ryanmen(&self) -> bool
pub fn is_true_ryanmen(&self) -> bool
Returns whether this waiting pattern is part of a double-sided wait, i.e. 45m waits 3m or 6m (両面). This mostly affects scoring and the Pinfu Yaku.
The reason this is separate is because we overloaded the “Ryanmen” term in WaitingKind
to broaden its scope to any 2 consecutive numerals, which simplified handling.
For game rule purposes, this method should be used.
Trait Implementations§
Source§impl Clone for RegularWait
impl Clone for RegularWait
Source§fn clone(&self) -> RegularWait
fn clone(&self) -> RegularWait
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegularWait
impl Debug for RegularWait
Source§impl Display for RegularWait
impl Display for RegularWait
Source§impl Ord for RegularWait
impl Ord for RegularWait
Source§impl PartialEq for RegularWait
impl PartialEq for RegularWait
Source§impl PartialOrd for RegularWait
impl PartialOrd for RegularWait
Source§impl Serialize for RegularWait
impl Serialize for RegularWait
impl Copy for RegularWait
impl Eq for RegularWait
Auto Trait Implementations§
impl Freeze for RegularWait
impl RefUnwindSafe for RegularWait
impl Send for RegularWait
impl Sync for RegularWait
impl Unpin for RegularWait
impl UnwindSafe for RegularWait
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: 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>
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>
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