mahjong.hand_calculating.yaku_config
Yaku configuration and ID mappings.
Data
YAKU_ID_TO_TENHOU_ID- mapping from library yaku IDs to Tenhou yaku IDs
Classes
YakuConfig- pre-instantiated collection of all yaku for condition checking
Look up a Tenhou yaku ID:
>>> from mahjong.hand_calculating.yaku_config import YAKU_ID_TO_TENHOU_ID
>>> from mahjong.hand_calculating.yaku_list import Riichi
>>> YAKU_ID_TO_TENHOU_ID[Riichi.yaku_id]
1
- mahjong.hand_calculating.yaku_config.YAKU_ID_TO_TENHOU_ID: dict[int, int] = {0: 0, 1: 1, 3: 2, 4: 3, 5: 4, 6: 5, 7: 6, 8: 21, 11: 36, 12: 7, 13: 8, 14: 9, 15: 18, 16: 19, 17: 20, 18: 10, 19: 11, 20: 12, 21: 13, 22: 14, 23: 15, 24: 16, 25: 17, 26: 25, 27: 24, 28: 23, 29: 31, 30: 28, 31: 29, 32: 27, 33: 26, 34: 22, 35: 30, 36: 34, 37: 33, 38: 32, 39: 35, 100: 47, 101: 45, 102: 40, 103: 39, 104: 50, 105: 43, 106: 51, 107: 42, 108: 44, 111: 49, 112: 48, 113: 41, 114: 46, 115: 37, 116: 38, 120: 52, 121: 54, 122: 53}
Mapping from library
yaku_idvalues to Tenhou yaku IDs.Useful for integrating with Tenhou log formats or displaying results in Tenhou-compatible order.
- class mahjong.hand_calculating.yaku_config.YakuConfig[source]
Bases:
objectPre-instantiated collection of all yaku (winning patterns) for condition checking.
Each attribute is a
Yakuinstance that can check whether its condition is met for a given hand decomposition. Yaku are grouped by han value: situational yaku, 1-han, 2-han, 3-han, 6-han, yakuman, double yakuman, yakuman situations, and bonus dora.A
YakuConfigis automatically created as part ofHandConfig, so most users do not need to instantiate it directly. Direct instantiation is useful for checking individual yaku conditions outside the full hand evaluation pipeline.Access yaku metadata:
>>> from mahjong.hand_calculating.yaku_config import YakuConfig >>> config = YakuConfig() >>> config.riichi.name 'Riichi' >>> config.riichi.han_closed 1