Closed illava closed 5 years ago
@illava has_aka_dora=True
had to be set to the options, not to the config itself.
from mahjong.hand_calculating.hand import HandCalculator
from mahjong.hand_calculating.hand_config import HandConfig, OptionalRules
from mahjong.tile import TilesConverter
calculator = HandCalculator()
def print_hand_result(hand_result):
print(hand_result.han, hand_result.fu)
print(hand_result.cost['main'])
print(hand_result.yaku)
for fu_item in hand_result.fu_details:
print(fu_item)
print('')
tiles = TilesConverter.string_to_136_array(man='22444', pin='333r67', sou='444', has_aka_dora=True)
win_tile = TilesConverter.string_to_136_array(sou='4')[0]
hand_config = HandConfig(
is_daburu_riichi=True,
options=OptionalRules(has_aka_dora=True),
)
result = calculator.estimate_hand_value(tiles, win_tile, config=hand_config)
print_hand_result(result)
Also, with v1.1.8 version you can pass 0
instead of r
as aka dora to tiles converter: https://github.com/MahjongRepository/mahjong/releases/tag/v1.1.8
I'm trying the examples of the project while aka dora is not calculated in hand calculator. Was it somewhere wrong configed?
Code
Expected
Actural
ver.1.1.7 python3 PS. Aka Dora usually express as "0" in games like tenhou,
11223s4506p3405s2z
etc. It'll be nice if "r" and "0" are both representing aka dora. Sincerely Illava.