MahjongRepository / mahjong

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

Fu calculation error #40

Closed lietxia closed 3 years ago

lietxia commented 3 years ago
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'}

Nihisil commented 3 years ago

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.