MahjongRepository / mahjong

Implementation of riichi mahjong related stuff (hand cost, shanten, agari end, etc.)
MIT License
381 stars 41 forks source link

Wrong Shanten Calculating #43

Open taeho-gwon opened 2 years ago

taeho-gwon commented 2 years ago
sh = Shanten()
tiles = TilesConverter.string_to_34_array(man='123456789', honors='1111')
print(sh.calculate_shanten_for_regular_hand(tiles))
tiles2 = TilesConverter.string_to_34_array(man='123456789', pin='1111')
print(sh.calculate_shanten_for_regular_hand(tiles2))

output

1
0

In shanten calculation, 4 non-honor tiles can be used as meld and waiting itself as pair, but it is impossible.

Nihisil commented 2 years ago

Thanks for the report, the shanten calculations are more correct with 14 tiles.

With 13 tiles, it may have the issue as you mentioned.

The bug needed to be fixed.