ritchie/hand/tenpai
Tenpai detection and waiting-tile enumeration.
A tenpai hand is one tile away from completion. Since decompose already
enumerates every waiting shape of such a hand, tenpai detection is the
aggregation of the resulting waiting tiles.
Values
pub fn is_tenpai(
hand: tile_set37.TileSet37,
melds: List(meld.Meld),
) -> Bool
Returns whether the hand is tenpai (one tile away from completion).
pub fn waiting_tiles(
hand: tile_set37.TileSet37,
melds: List(meld.Meld),
) -> List(tile.Tile)
Returns the distinct tiles that would complete the hand, in encoding order.
Waiting tiles are normal tiles: a wait on 0m is reported as 5m, since
either copy completes the hand.
The hand must hold decompose.expected_hand_size(melds) concealed tiles,
any other size has no waits.