Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mahjong/shanten.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ def calculate_shanten_for_regular_hand(tiles_34: Sequence[int]) -> int:
"""
Calculate the shanten number for a regular hand (4 melds + 1 pair).

The number of melds to be calculated is determined based on the number of tiles in the hand.
The number of melds is determined as ``number_of_tiles // 3``
(e.g., 0 for 1-2 tiles, 1 for 4-5 tiles, ..., 4 for 13-14 tiles).
If there are fewer than 4 melds, the remaining melds are treated as open melds.

Use a depth-first search over all possible meld/pair/tatsu decompositions
of the suited tiles (indices 0-26), after pre-processing honor tiles (indices 27-33).

Expand Down
Loading