Skip to main content

Mahjong hands calculation

Project description

mahjong

PyPI License Supported Python versions PyPI Downloads Linters and tests API Docs

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

How to install

pip install mahjong

Local development setup

To set up the project locally for development:

  1. Clone the repository:

    git clone https://github.com/MahjongRepository/mahjong.git
    cd mahjong
    
  2. Setup env using uv:

    uv sync
    
  3. Run tests to verify setup:

    make tests
    # Or directly:
    uv run pytest
    
  4. Run full checks before committing:

    make check   # Runs format, lint, and tests
    

License

This library is licensed under the MIT license.

Project details


Download files

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

Source Distribution

mahjong-2.0.0.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

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

mahjong-2.0.0-py3-none-any.whl (86.0 kB view details)

Uploaded Python 3

File details

Details for the file mahjong-2.0.0.tar.gz.

File metadata

  • Download URL: mahjong-2.0.0.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for mahjong-2.0.0.tar.gz
Algorithm Hash digest
SHA256 08c424be257d6aebdf320e90fd8ee11628bf7a463860490ad007162bb62f22be
MD5 bf274c645644475f0ae775ec1ea1f93d
BLAKE2b-256 9a4489c67394c97ee060b86f02868c819c2c63cf199fda40f6c47eee08d1818d

See more details on using hashes here.

File details

Details for the file mahjong-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: mahjong-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 86.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for mahjong-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52f63a8dfda5a9e81542642ed315f0e1e8626c0d324c8d8eabb3418ae7d43870
MD5 e40e8d2ef2561b634226f4c97dcf7404
BLAKE2b-256 3002687973dca9ab7372a8db48752fd3350a6b9c36b7807efdeb55e1ebf3779c

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