Mahjong hands calculation
Project description
mahjong
This library can calculate hand cost (han, fu with details, yaku, and scores) for riichi mahjong (Japanese version).
Also calculating of shanten is supported.
The code was validated on tenhou.net phoenix replays in total on 11,120,125 hands.
So, we can say that our hand calculator works the same way that tenhou.net hand calculation.
How to install
pip install mahjong
Supported rules and usage examples
You can find usage examples and information about all supported rules variations in the wiki
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
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
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-1.4.0.tar.gz.
File metadata
- Download URL: mahjong-1.4.0.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af3d0183a904219b74fb0edbcf0e68a522168012782143b48f7f6f424784aafe
|
|
| MD5 |
bb9ac9a1852a93dee03a1ca304c2469e
|
|
| BLAKE2b-256 |
b416f2025a635f443b3de5fbc88a73d8577c14724bdfc2ab5bfc5f900c2fcd45
|
File details
Details for the file mahjong-1.4.0-py3-none-any.whl.
File metadata
- Download URL: mahjong-1.4.0-py3-none-any.whl
- Upload date:
- Size: 65.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26e1c487973917b3e17358a75809277fc3d868db03f9c4126fc9fa22f142cafe
|
|
| MD5 |
dbe8e2051362ab7943ea61d206bdb2cf
|
|
| BLAKE2b-256 |
0b3da55b729708a6c0acafdc6ebe908ef4a2d3826ecfd403bddb79ad54d9dc62
|