Skip to main content

Mahjong hands calculation

Project description

mahjong

PyPI License Supported Python versions PyPI Downloads Linters and tests

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:

  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
    

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-1.4.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

mahjong-1.4.0-py3-none-any.whl (65.7 kB view details)

Uploaded Python 3

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

Hashes for mahjong-1.4.0.tar.gz
Algorithm Hash digest
SHA256 af3d0183a904219b74fb0edbcf0e68a522168012782143b48f7f6f424784aafe
MD5 bb9ac9a1852a93dee03a1ca304c2469e
BLAKE2b-256 b416f2025a635f443b3de5fbc88a73d8577c14724bdfc2ab5bfc5f900c2fcd45

See more details on using hashes here.

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

Hashes for mahjong-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26e1c487973917b3e17358a75809277fc3d868db03f9c4126fc9fa22f142cafe
MD5 dbe8e2051362ab7943ea61d206bdb2cf
BLAKE2b-256 0b3da55b729708a6c0acafdc6ebe908ef4a2d3826ecfd403bddb79ad54d9dc62

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