Skip to main content

Mahjong Library for Python

Project description

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_list136from_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.txt
  • tests/data/shanten/p_koku_10000.txt
  • tests/data/shanten/p_normal_10000.txt
  • tests/data/shanten/p_tin_10000.txt

は、あらの一人麻雀研究所 からお借りしました。

その他、一部のテストデータは天鳳の牌譜から作成しました。

Benchmark

https://zurukumo.github.io/kago-utils/dev/bench/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kago_utils-0.1.5-cp314-cp314t-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.14tWindows x86-64

kago_utils-0.1.5-cp314-cp314t-win32.whl (1.0 MB view details)

Uploaded CPython 3.14tWindows x86

kago_utils-0.1.5-cp314-cp314t-musllinux_1_2_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

kago_utils-0.1.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

kago_utils-0.1.5-cp314-cp314t-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

kago_utils-0.1.5-cp314-cp314-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.14Windows x86-64

kago_utils-0.1.5-cp314-cp314-win32.whl (1.0 MB view details)

Uploaded CPython 3.14Windows x86

kago_utils-0.1.5-cp314-cp314-musllinux_1_2_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

kago_utils-0.1.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

kago_utils-0.1.5-cp314-cp314-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

kago_utils-0.1.5-cp313-cp313-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.13Windows x86-64

kago_utils-0.1.5-cp313-cp313-win32.whl (1.0 MB view details)

Uploaded CPython 3.13Windows x86

kago_utils-0.1.5-cp313-cp313-musllinux_1_2_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

kago_utils-0.1.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

kago_utils-0.1.5-cp313-cp313-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kago_utils-0.1.5-cp312-cp312-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.12Windows x86-64

kago_utils-0.1.5-cp312-cp312-win32.whl (1.0 MB view details)

Uploaded CPython 3.12Windows x86

kago_utils-0.1.5-cp312-cp312-musllinux_1_2_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

kago_utils-0.1.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

kago_utils-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file kago_utils-0.1.5-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 5bd83270dcc3a55f61704f9c491ac696d8fe9e1a6637e5013e53b3f42016a6e0
MD5 b3eb7ead24562f06570ac5f4ed8ae256
BLAKE2b-256 f6291d591310c28399e7b64c8dc4452867e5656716274f064d3b7baec01dfaf4

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314t-win32.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp314-cp314t-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.14t, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 b7a1938b8f480cd3b52d59368526fc907e6b985fc4120fc59b19c0ab79885c99
MD5 d95f03aaa7dc1d1b56273d9e32ed9e7f
BLAKE2b-256 5261b514db51b763fe56b4a6c7bd4b59d58710e90b5533486c3e17ab3ff7c2fb

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bf008732220f3ae757f203869e74181eddc587523eff0b1dec5044ff6f007d95
MD5 ba620dfa552c3fb62f2b8d0124f1ee95
BLAKE2b-256 53dfa277a2c05d8d1f39866f9dfe64cc0ff444dfb7f4c4e1cac1a06b82b62aa8

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 59fa86258389609fe1e89e4caab8fb82c189566dd0e7839e87bd2dec46e89695
MD5 ea1bd63f586fd943cf15b151e81d5c38
BLAKE2b-256 90dd7053070bcfac20b2894174e6210c83334198d887c425591bcb2adf2dc62a

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b04c8547970977271153d275fba95e482f4331edb7563cabcf5c5523fba5ce10
MD5 eb2ed2ea154d498c2c20c566420b576b
BLAKE2b-256 392603a1f3ad832696175dfd89ec48415b7411bf5507c459b884b6e3259d78ea

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a1ac3647d443798c25186012f0c11b2ab48aab1fd0c41c0d5979941aa65691ef
MD5 b41a17eb8b4f78d625553ba3722e12d3
BLAKE2b-256 2324c1d4603bcb652cd79337fd13dd3b5013fe48803fee065e39897859bde694

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314-win32.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp314-cp314-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.14, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 031544bdcf7c7e37f18555f9dc374d1f03e82b1fbd63e2e884d5d662d3a21e7f
MD5 b57b439b32db25884aead3da550bcb84
BLAKE2b-256 8f69f3689835b7072c94d41dce603cd1570d452264ad70fd554dccf9b9cd3f44

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4e5e7faff71289f341c729870214ce03b13d69dc857eaec82361c296c739e891
MD5 7ffa09fc9dbf97a365bc2d3ac894c4c3
BLAKE2b-256 f0b29cecb858035678b32cfb9232019110705a948bcada044746a0bbed799f9f

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 8a9b598c2d306cf5c47506ed48e9da257b8e664efd32fcde73ff846ae7801294
MD5 0d406fe6920fa25ed59494d8e8d668d0
BLAKE2b-256 c9e250b3987c4e727b50a177c77fb9714b916d0609ae2cba10c52b1ac39f05f3

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 985b84295007ff64cae2ee917e6b68ce07c964e6c237d3ccefbf1e0cfe17f9f1
MD5 5f516d9ea2ca6a134b98c1cf35c1fe6d
BLAKE2b-256 ff420a626c5ca8733064f39854aeba7ea8b6eabb8152cb7ae2018bd02a44c13d

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 72982693d25a9f76fa9dd8959eb3174785b84da332989379676555f8206a8904
MD5 1ee04713ff0e496305e9ff4b9a60a75e
BLAKE2b-256 f763f215f39ca3bf17d42bc4de5f7a9c3606fe761105f4bb317bcbf4e490459a

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp313-cp313-win32.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp313-cp313-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 8b8f8c50987b393a70bd9e5ba65ed5631a567ec24b0c128e07aebb1ffa8d0d0e
MD5 835a617a73dd8b40d6853d9206bb0672
BLAKE2b-256 08fa55b34f582ff6773e42cca489e7e23ac3c0abef896593eb5a9dd30d5ec513

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5bafb9cf31c933d6b60bc640f5f18543e587b050d68bc0ea0ef8163f0e5910fe
MD5 ca8221c8a7cc108310bc0b4f70154282
BLAKE2b-256 be6ef31e4850c4a75f35b58fc7c7bc443866774eba04fc74eec3fc67b90dd4bd

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 deca49541b0b550e8055899a76ea50908f5d746df03c15bbc93ccdc915441207
MD5 2965185d5883d3f2c34c53898864be73
BLAKE2b-256 9a1dec5ce0294559bd8a28fe20637f201ee4e422e321960373f027a1b2b0d3bf

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4806bad6db4b2802fdc26b23b332fb7509f6e4ebe29f438eb23760448c13487e
MD5 7440d422e125076ee6c443e42368dcd7
BLAKE2b-256 855bc7a01736ffdd95f66a4fb7557b0f3ff57a4883e6360ad571bf366d3ccb16

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 18fe49ab5e3d5b63249e970b510a7fcf2d81ad8e58d100a8b4f2e28df443da11
MD5 af777dfe4ddb535b1dbfb51d33e75be2
BLAKE2b-256 90694fdac65660cf70d7206c915bead1d1c7133f712815170c3899fe345e827a

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp312-cp312-win32.whl.

File metadata

  • Download URL: kago_utils-0.1.5-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kago_utils-0.1.5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d8eb8117d2a7542934d47dd4f12a6843579277f21f7f5c56440258939634d29f
MD5 de20378c97c16220de837ea77bfa00d5
BLAKE2b-256 49943e65b234935ec98d9453d346b9198ab29f2e9f5619a08c5eae433ac2444f

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 73ab2d27d79609862a5cf8575ec55525de936c01332df1f1c1056c398c0c41b7
MD5 75f65eed97edd55966c49bcdd13eee70
BLAKE2b-256 e40202a69e5cd9b056e839b0dee04fed13415d7fdc8da748e14158a3f39188c7

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 79ad48c6e16bdab85f815ea94e267749b4e477cbf4f648e739f0db8bb31a3aa6
MD5 8a5d8189494e4d743fc8b1bca38e132e
BLAKE2b-256 12e9d03f553c5b6382cb8304f641d7579ee12c6b2f35c5ee2b09db0d014aa9af

See more details on using hashes here.

File details

Details for the file kago_utils-0.1.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kago_utils-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70561acd6bd5b3c2b54c7cd39b067041edc5359004b7df98fea7e67c41c09997
MD5 04d19668b7e757999298e41e406fdf9a
BLAKE2b-256 902208204821de0464af32d98efe366b330aec97a848cab781d90eb72a6e8dde

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page