MahjongRepository/mahjong

Fu calculation error

lietxia opened this issue · 1 comments

from mahjong.hand_calculating.hand import HandCalculator
from mahjong.tile import TilesConverter
from mahjong.hand_calculating.hand_config import HandConfig
from mahjong.meld import Meld

calculator = HandCalculator()

# we had to use all 14 tiles in that array
tiles = TilesConverter.one_line_string_to_136_array("234m11123567774s")
win_tile =TilesConverter.one_line_string_to_136_array("4s")[0]

result = calculator.estimate_hand_value(tiles, win_tile,config=HandConfig(is_tsumo=True))

print(result.han, result.fu)
print(result.cost['main'])
print(result.yaku)
for fu_item in result.fu_details:
    print(fu_item)

RETURN

1 30
500
[Menzen Tsumo]
{'fu': 20, 'reason': 'base'}
{'fu': 4, 'reason': 'closed_pon'}
{'fu': 2, 'reason': 'tsumo'}

{'fu': 4, 'reason': 'closed_pon'} should be {'fu': 8, 'reason': 'closed_terminal_pon'}

Good catch. It doesn't change hand cost (both hands cost 1 han 30 fu), but it affects displaying of fu details. Will fix it in next days.