How duma520/mahjong_calculator works
Mahjong Calculator is a Chinese Official Mahjong scoring tool. Players enter concealed tiles, melds, winning-tile circumstances, and winds in the desktop or Web interface; the app analyzes waits and scores a completed hand, reporting fan totals and qualifying patterns. The core also exposes a Python/JSON-facing interface and command-line entry point, while the Web server enables browser and LAN access. README capabilities guide the map; source excerpts are partial, so uncertain internal wiring is omitted.
Main entry points: mahjong_core.py Core API · Mahjong_Calculator.py Desktop App · mahjong_api.py JSON Routes
Components 19
User Interfaces
- Desktop App
Mahjong_Calculator.py - Hand Input
Mahjong_Calculator.py - Wait Analysis
Mahjong_Calculator.py - Score Results
Mahjong_Calculator.py - Fan Reference
Mahjong_Calculator.py
Web Service
- HTTP Server
mahjong_api.py - Web Interface
mahjong_api.py - JSON Routes
mahjong_api.py - Token Access
mahjong_api.py
Scoring Engine
- Core API
mahjong_core.py - Hand Decomposition
mahjong_core.py - Fan Detection
mahjong_core.py - Exclusions and Score
mahjong_core.py - Wait Calculation
mahjong_core.py - Fan Catalog
mahjong_core.py
Programmatic Access
- Command Line
mahjong_core.py
Other components
- Desktop Player
- Browser Player
- API Consumer
Connections 21
- Desktop Player → Desktop App: uses
- Desktop App → Hand Input: provides
- Hand Input → Core API: submits hand
- Core API → Wait Calculation: analyzes waits
- Core API → Hand Decomposition: decomposes hand
- Hand Decomposition → Fan Detection: checks patterns
- Fan Detection → Exclusions and Score: applies scoring
- Wait Calculation → Wait Analysis: returns waits
- Exclusions and Score → Score Results: returns score
- Desktop App → Fan Reference: shows reference
- Fan Catalog → Fan Reference: supplies definitions
- Desktop App → HTTP Server: starts service
- Browser Player → HTTP Server: connects
- HTTP Server → Web Interface: serves page
- Web Interface → JSON Routes: submits requests
- JSON Routes → Token Access: checks access
- JSON Routes → Core API: calls scoring
- Core API → JSON Routes: returns result
- API Consumer → Core API: calls directly
- API Consumer → Command Line: runs
- Command Line → Core API: invokes