No project description provided
Project description
mahjong-utils
已实现功能:
- 获取番符对应和牌点数
- 向听数、进张分析
- 和了分析(役种、番数、符数)
获取番符对应和牌点数
from mahjong_utils.point_by_han_hu import get_parent_point_by_han_hu, get_child_point_by_han_hu
# 获取亲家X番Y符的点数,返回(荣和点数, 自摸各家点数)
parent_ron, parent_tsumo = get_parent_point_by_han_hu(3, 40)
# parent_ron == 7700
# parent_tsumo == 2600
# 获取子家X番Y符的点数,返回(荣和点数, 自摸庄家点数, 自摸闲家点数)
child_ron, child_tsumo_parent, child_tsumo_child = get_child_point_by_han_hu(3, 40)
# child_ron == 5200
# child_tsumo_child == 1300
# child_tsumo_parent == 2600
向听数、进张分析
from mahjong_utils.models.tile import parse_tiles
from mahjong_utils.shanten import shanten
# 向听数、进张分析(未摸牌状态)
result = shanten(parse_tiles("34568m235p68s"))
# result.shanten == 2
# result.advance == {3M, 6M, 7M, 8M, 1P, 2P, 3P, 4P, 5P, 6S, 7S, 8S}
# 向听数、进张分析(已摸牌状态)
result = shanten(parse_tiles("34568m235p368s"))
# result.shanten == 2
# result.discard_to_advance == {
# 5P: {3M, 6M, 7M, 8M, 1P, 2P, 3P, 4P, 3S, 6S, 7S, 8S},
# 3S: {3M, 6M, 7M, 8M, 1P, 2P, 3P, 4P, 5P, 6S, 7S, 8S},
# 2P: {3M, 6M, 7M, 8M, 3P, 4P, 5P, 3S, 6S, 7S, 8S},
# 8M: {3M, 6M, 1P, 2P, 4P, 5P, 3S, 7S},
# 3M: {8M, 1P, 2P, 4P, 5P, 3S, 7S},
# 6M: {8M ,1P, 2P, 4P, 5P, 3S, 7S},
# 6S: {7M, 1P, 2P, 4P, 5P, 3S, 8S},
# 8S: {7M, 1P, 2P, 4P, 5P, 3S, 6S},
# 3P: {7M, 2P, 5P, 3S, 7S},
# }
和了分析
from mahjong_utils.hora import build_hora
from mahjong_utils.models.tile import parse_tiles, tile
from mahjong_utils.models.wind import Wind
from mahjong_utils.models.furo import parse_furo
from mahjong_utils.yaku.common import self_wind, round_wind
# 和了分析
hora = build_hora(
tiles=parse_tiles("12233466m11z"),
furo=[parse_furo("789p")],
agari=tile("1z"),
tsumo=True,
dora=4,
self_wind=Wind.east,
round_wind=Wind.east
)
# hora.yaku == {self_wind, round_wind}
# hora.han == 6
# hora.hand.hu == 30
# hora.parent_point == (18000, 6000)
# hora.child_point == (12000, 6000, 3000)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mahjong_utils-0.1.0a12.tar.gz
(19.9 kB
view hashes)
Built Distribution
Close
Hashes for mahjong_utils-0.1.0a12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a266a26cf37642d96ad2a7b62e43d050314c61b01e481635362aefdfa79d60f |
|
MD5 | f6db58f6a3caf1b3b59703ddbf4350f7 |
|
BLAKE2b-256 | 785d32695d4badfc24e600e7d86aa649648748f1403fa0d06a1025b521154c37 |