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.0a10.tar.gz
(19.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mahjong_utils-0.1.0a10.tar.gz.
File metadata
- Download URL: mahjong_utils-0.1.0a10.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf79bf09e7c5fd227a4ae7c127c9c28255d171a655bf6c5be657f532246d941
|
|
| MD5 |
38c56e18d9e89a8e036ac8fedb53707b
|
|
| BLAKE2b-256 |
c40673fed10ea7ac004e1094d944f74c987ebe83e528bacb733707e8512f64f1
|
File details
Details for the file mahjong_utils-0.1.0a10-py3-none-any.whl.
File metadata
- Download URL: mahjong_utils-0.1.0a10-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
435a4b30ae7334980438c89f60f72a33386c5b6ebee6c6875cb2c24e4366835e
|
|
| MD5 |
9011bf1902f94d507d3850fcf46a867f
|
|
| BLAKE2b-256 |
f857042f76478f4e93df2be7b246406c63cab3b7f98d053e2618e2597a7e1a5c
|