Replies: 3 comments 12 replies
-
|
Regarding Topic 2: The current algorithm does not appear to return a consistent shanten number for a hand of 3n tiles. Example: # ruff: noqa: D103, T201
from mahjong.shanten import Shanten
from mahjong.tile import TilesConverter
def print_shanten(mpsz: str) -> None:
tiles = TilesConverter.one_line_string_to_34_array(mpsz)
print(f"shanten for {mpsz}: {Shanten.calculate_shanten(tiles)}")
print_shanten("")
print()
print_shanten("1m")
print_shanten("12m")
print_shanten("123m")
print_shanten("124m")
print_shanten("135m")
print()
print_shanten("1m")
print_shanten("11m")
print_shanten("111m")Output: |
Beta Was this translation helpful? Give feedback.
-
|
Regarding Topic 3 Personally, I'm reluctant to change or add to the algorithm. There are roughly three methods for calculating Shanten numbers:
Each method has its own issues.
|
Beta Was this translation helpful? Give feedback.
-
|
Regarding Topic 1 Currently, the shanten number for a regular hand is computed with respect to a target form of " However, this assumption is not explicitly documented in the docstring. While the existing code examples illustrate specific cases such as 0 melds or 1 melds, they do not clearly state the general definition of the target form used for the shanten calculation. Therefore, the documentation should explicitly clarify the following points:
Making this assumption explicit will improve clarity of the algorithm's specification. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
-> resolved in docs: Clarify shanten calculation details and target hand structure in docstring #263
-> resolved in bug: stabilize shanten input validation #242
-> not to change
Beta Was this translation helpful? Give feedback.
All reactions