# yuanfengyun/q_algorithm

棋牌的胡牌算法，包括麻将、跑胡子、扑克。实现 lua 、c++ 、c# 、golang 、js 、java 、python 版本。( Mahjong  algorithm )

Repository: https://github.com/yuanfengyun/q_algorithm
Canonical: https://ross.abutalabs.com/products/q_algorithm
Language: Lua
License Family: other
Topics: lua, majhong, paohuzi, doudizhu, algorithm
Last push: 2024-06-14T02:49:03+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3530, "days_push": 810, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2101, forks 850 (observed 2026-08-28T04:06:13.613834+00:00)

## What it is
A multi-language library implementing efficient winning-hand (hu) detection algorithms for tile and card games, including Mahjong, Paohuzi, and Doudizhu. It supports arbitrary numbers of wildcards (jokers) and special hand pattern detection, with implementations in Lua, C++, C#, Golang, JS, Java, and Python.

## Use cases
- check if a mahjong hand is a winning hand
- detect mahjong winning hands with jokers/wildcards
- judge special mahjong patterns like seven pairs or thirteen orphans
- implement hu detection for a mahjong game server
- validate paohuzi card hands
- split and analyze tile hands for game logic

## When to choose
- you need fast, battle-tested mahjong win detection in one of the supported languages
- your game must handle arbitrary wildcard (lai zi) counts
- you need special hand pattern recognition (qing yi se, peng peng hu, etc.)

## When to avoid
- you need full game rules, scoring, or AI opponents - this only judges hands
- you work in a language not among the provided implementations
- you require a maintained release with a license for commercial use

## Facets
- artifact type: library
- maturity: active
- function: parser, developer-tools
- domain: gaming-tools
- platform: cross-platform, lua, cpp, python, go, jvm, dotnet
- tags: mahjong, win-detection, card-games, paohuzi, doudizhu, multi-language, table-lookup, algorithm, game-development, algorithms, javascript

## Member repositories
- yuanfengyun/q_algorithm (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:13.613834+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:54:19.328705+00:00, confidence not recorded.
  - readme: https://github.com/yuanfengyun/q_algorithm (fetched 2026-08-28T04:06:13.613834+00:00, sha 9868893f5e67)
- Data as of 2026-08-30T08:39:29.467469+00:00.
