mahjong
Japanese riichi mahjong hand calculator library.
Compute hand cost (han, fu, yaku, and scores), validate winning hands, and calculate shanten (minimum tiles to tenpai).
The code was validated on tenhou.net phoenix replays in total on 26,148,038 hands.
So, we can say that our hand calculator works the same way that tenhou.net hand calculation.
Documentation
- API reference
- Wiki — Supported rules and usage examples
How to install
pip install mahjong
Local development setup
To set up the project locally for development:
-
Clone the repository:
git clone https://github.com/MahjongRepository/mahjong.git cd mahjong
-
Setup env using uv:
uv sync -
Run tests to verify setup:
make tests # Or directly: uv run pytest
-
Run full checks before committing:
make check # Runs format, lint, and tests
License
This library is licensed under the MIT license.
Metadata
Release files for mahjong 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mahjong-2.0.0.tar.gz | 52.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mahjong-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.9 kB
Release files / mahjong-2.0.0.tar.gz
| Download URL | mahjong-2.0.0.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08c424be257d6aebdf320e90fd8ee11628bf7a463860490ad007162bb62f22be
|
|
BLAKE2b-256 checksum How to use checksums |
9a4489c67394c97ee060b86f02868c819c2c63cf199fda40f6c47eee08d1818d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mahjong-2.0.0-py3-none-any.whl
| Download URL | mahjong-2.0.0-py3-none-any.whl |
|---|---|
| Size | 86.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52f63a8dfda5a9e81542642ed315f0e1e8626c0d324c8d8eabb3418ae7d43870
|
|
BLAKE2b-256 checksum How to use checksums |
3002687973dca9ab7372a8db48752fd3350a6b9c36b7807efdeb55e1ebf3779c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|