kago-utils
Python用の麻雀ライブラリ。
Mahjong library for Python.
インストール
pip install kago-utils
使い方
牌姿の定義
from kago_utils.hai_group import HaiGroup
# from_codeの0は赤5を意味します。天鳳の牌理ツールと同じ仕様です。
tehai1 = HaiGroup.from_code("123m406p789s11122z")
tehai2 = HaiGroup.from_list34([0, 1, 2, 12, 13, 14, 24, 25, 26, 27, 27, 27, 28, 28])
tehai3 = HaiGroup.from_counter34([
1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1,
3, 2, 0, 0, 0, 0, 0
])
print(tehai1 == tehai2 == tehai3) # True
from_list136とfrom_counter136も同様に使えます。
向聴数の計算
from kago_utils.hai_group import HaiGroup
from kago_utils.shanten import calculate_shanten
# 手牌
tehai = HaiGroup.from_code("123m456p789s11122z")
# 向聴数
shanten = calculate_shanten(tehai)
print(shanten) # -1
謝辞
tests/data/shanten/p_hon_10000.txttests/data/shanten/p_koku_10000.txttests/data/shanten/p_normal_10000.txttests/data/shanten/p_tin_10000.txt
は、あらの一人麻雀研究所 からお借りしました。
その他、一部のテストデータは天鳳の牌譜から作成しました。
Benchmark
Metadata
Release files for kago-utils 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 20.5 MB
Release files / kago_utils-0.1.5-cp314-cp314t-win_amd64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5bd83270dcc3a55f61704f9c491ac696d8fe9e1a6637e5013e53b3f42016a6e0
|
|
BLAKE2b-256 checksum How to use checksums |
f6291d591310c28399e7b64c8dc4452867e5656716274f064d3b7baec01dfaf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp314-cp314t-win32.whl
| Download URL | kago_utils-0.1.5-cp314-cp314t-win32.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-32 |
|
SHA-256 checksum How to use checksums |
b7a1938b8f480cd3b52d59368526fc907e6b985fc4120fc59b19c0ab79885c99
|
|
BLAKE2b-256 checksum How to use checksums |
5261b514db51b763fe56b4a6c7bd4b59d58710e90b5533486c3e17ab3ff7c2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp314-cp314t-musllinux_1_2_x86_64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314t-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
bf008732220f3ae757f203869e74181eddc587523eff0b1dec5044ff6f007d95
|
|
BLAKE2b-256 checksum How to use checksums |
53dfa277a2c05d8d1f39866f9dfe64cc0ff444dfb7f4c4e1cac1a06b82b62aa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
59fa86258389609fe1e89e4caab8fb82c189566dd0e7839e87bd2dec46e89695
|
|
BLAKE2b-256 checksum How to use checksums |
90dd7053070bcfac20b2894174e6210c83334198d887c425591bcb2adf2dc62a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b04c8547970977271153d275fba95e482f4331edb7563cabcf5c5523fba5ce10
|
|
BLAKE2b-256 checksum How to use checksums |
392603a1f3ad832696175dfd89ec48415b7411bf5507c459b884b6e3259d78ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp314-cp314-win_amd64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a1ac3647d443798c25186012f0c11b2ab48aab1fd0c41c0d5979941aa65691ef
|
|
BLAKE2b-256 checksum How to use checksums |
2324c1d4603bcb652cd79337fd13dd3b5013fe48803fee065e39897859bde694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp314-cp314-win32.whl
| Download URL | kago_utils-0.1.5-cp314-cp314-win32.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
031544bdcf7c7e37f18555f9dc374d1f03e82b1fbd63e2e884d5d662d3a21e7f
|
|
BLAKE2b-256 checksum How to use checksums |
8f69f3689835b7072c94d41dce603cd1570d452264ad70fd554dccf9b9cd3f44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp314-cp314-musllinux_1_2_x86_64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
4e5e7faff71289f341c729870214ce03b13d69dc857eaec82361c296c739e891
|
|
BLAKE2b-256 checksum How to use checksums |
f0b29cecb858035678b32cfb9232019110705a948bcada044746a0bbed799f9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a9b598c2d306cf5c47506ed48e9da257b8e664efd32fcde73ff846ae7801294
|
|
BLAKE2b-256 checksum How to use checksums |
c9e250b3987c4e727b50a177c77fb9714b916d0609ae2cba10c52b1ac39f05f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | kago_utils-0.1.5-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
985b84295007ff64cae2ee917e6b68ce07c964e6c237d3ccefbf1e0cfe17f9f1
|
|
BLAKE2b-256 checksum How to use checksums |
ff420a626c5ca8733064f39854aeba7ea8b6eabb8152cb7ae2018bd02a44c13d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp313-cp313-win_amd64.whl
| Download URL | kago_utils-0.1.5-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
72982693d25a9f76fa9dd8959eb3174785b84da332989379676555f8206a8904
|
|
BLAKE2b-256 checksum How to use checksums |
f763f215f39ca3bf17d42bc4de5f7a9c3606fe761105f4bb317bcbf4e490459a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp313-cp313-win32.whl
| Download URL | kago_utils-0.1.5-cp313-cp313-win32.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
8b8f8c50987b393a70bd9e5ba65ed5631a567ec24b0c128e07aebb1ffa8d0d0e
|
|
BLAKE2b-256 checksum How to use checksums |
08fa55b34f582ff6773e42cca489e7e23ac3c0abef896593eb5a9dd30d5ec513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | kago_utils-0.1.5-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
5bafb9cf31c933d6b60bc640f5f18543e587b050d68bc0ea0ef8163f0e5910fe
|
|
BLAKE2b-256 checksum How to use checksums |
be6ef31e4850c4a75f35b58fc7c7bc443866774eba04fc74eec3fc67b90dd4bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | kago_utils-0.1.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
deca49541b0b550e8055899a76ea50908f5d746df03c15bbc93ccdc915441207
|
|
BLAKE2b-256 checksum How to use checksums |
9a1dec5ce0294559bd8a28fe20637f201ee4e422e321960373f027a1b2b0d3bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | kago_utils-0.1.5-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4806bad6db4b2802fdc26b23b332fb7509f6e4ebe29f438eb23760448c13487e
|
|
BLAKE2b-256 checksum How to use checksums |
855bc7a01736ffdd95f66a4fb7557b0f3ff57a4883e6360ad571bf366d3ccb16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp312-cp312-win_amd64.whl
| Download URL | kago_utils-0.1.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
18fe49ab5e3d5b63249e970b510a7fcf2d81ad8e58d100a8b4f2e28df443da11
|
|
BLAKE2b-256 checksum How to use checksums |
90694fdac65660cf70d7206c915bead1d1c7133f712815170c3899fe345e827a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp312-cp312-win32.whl
| Download URL | kago_utils-0.1.5-cp312-cp312-win32.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
d8eb8117d2a7542934d47dd4f12a6843579277f21f7f5c56440258939634d29f
|
|
BLAKE2b-256 checksum How to use checksums |
49943e65b234935ec98d9453d346b9198ab29f2e9f5619a08c5eae433ac2444f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kago_utils-0.1.5-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | kago_utils-0.1.5-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
73ab2d27d79609862a5cf8575ec55525de936c01332df1f1c1056c398c0c41b7
|
|
BLAKE2b-256 checksum How to use checksums |
e40202a69e5cd9b056e839b0dee04fed13415d7fdc8da748e14158a3f39188c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | kago_utils-0.1.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
79ad48c6e16bdab85f815ea94e267749b4e477cbf4f648e739f0db8bb31a3aa6
|
|
BLAKE2b-256 checksum How to use checksums |
12e9d03f553c5b6382cb8304f641d7579ee12c6b2f35c5ee2b09db0d014aa9af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / kago_utils-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | kago_utils-0.1.5-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
70561acd6bd5b3c2b54c7cd39b067041edc5359004b7df98fea7e67c41c09997
|
|
BLAKE2b-256 checksum How to use checksums |
902208204821de0464af32d98efe366b330aec97a848cab781d90eb72a6e8dde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|