Skip to main content
Formal Specification

Sparrow Tiles (Mahjong) — Formal Specification

China · tile · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 3
# Majiang — AI-optimized specification ## General idea A four-player tile-based imperfect-information game of set collection and probability management. Players draw and discard from a 136-tile pool (3 suited numerical suits of 1–9 and 7 honor tile types, 4 copies each) to assemble a 14-tile winning hand comprising 4 melds (sequences of 3 consecutive suited tiles or triplets of 3 identical tiles) and 1 matching pair of eyes. Players may interrupt standard counter-clockwise turn order to claim opponents' discards for Melds (*Chow*, *Pung*, *Kong*) or an immediate Win (*Hu*). ## Formal model - **Abstraction taken:** None required for core discrete tile logic; formalizes the standard 136-tile system (excluding optional season/flower bonus tiles for baseline algorithmic clarity). [gap-fill] - **Player/agent count:** 4 players seated at positions {0:East/Dealer,1:South,2:West,3:North}. - **Turn model:** Sequential counter-clockwise draw-and-discard turns with out-of-turn claim preemption priority windows following each discard. ## Formal rules R1. Tile Inventory: A multiset of 136 tiles: - **Suits (108 tiles):** Dots (*Tong* 1..9), Bamboo (*Tiao* 1..9), Characters (*Wan* 1..9), 4 copies of each. - **Honors (28 tiles):** Winds (East, South, West, North) × 4, Dragons (Red, Green, White) × 4. R2. Deal & Hand Setup: Tiles are shuffled and constructed into a 68-stack wall. East (Dealer) receives 14 tiles; South, West, and North receive 13 tiles each. R3. Turn Loop: - Active player draws 1 tile from the front of the live wall (unless the turn was initiated via a claimed discard meld). - If the 14-tile hand constitutes a valid complete hand, the player may declare a Self-Draw Win (*Zimo*). - Otherwise, the player selects and discards 1 tile face-up into the public discard pool. R4. Discard Claim Priority Window: When a tile is discarded by Player k, other players may claim the discard according to strict precedence: - **Priority 1 — Win (*Hu* / *He*):** Any player who completes a 14-tile winning hand using the discarded tile. If multiple players claim *Hu*, priority follows turn order from the discarder (*Ronghe*). - **Priority 2 — Kong (*Gang*):** Any player holding 3 identical tiles may claim the 4th to form an exposed quad, immediately drawing a replacement tile from the back of the wall. - **Priority 3 — Pung (*Peng*):** Any player holding 2 identical tiles may claim a 3rd to form an exposed triplet. - **Priority 4 — Chow (*Chi*):** Only the player immediately to the discarder's right (Player (k+1)mod4) may claim a discard to form a 3-tile suited numerical sequence. R5. Hand Structure Requirement: A winning hand (*Hu*) must consist of exactly 14 tiles satisfying: Hand=4×Meld(Sequence or Triplet)+1×Pair (Special patterns like Seven Pairs / *Qiduizi* are also recognized as winning hands). R6. End of Round & Wall Exhaustion: - A round ends immediately upon a valid *Hu* declaration by any player. - If the wall is depleted to a dead wall reserve of 14 tiles without a winning claim, the round terminates in a Draw (*Huangzhuang*). R7. [gap-fill] Minimum Score Requirement: To declare a valid win (*Hu*), a player's hand must satisfy a minimum threshold of 8 scoring points (*Guobiao* standard) or 1 qualifying *fan* (traditional standard). R8. [gap-fill] Turn Time Limit: Each player has a maximum decision timer of 10.0 seconds per draw/discard and 3.0 seconds for discard claim declarations. ## Edge cases - **Tie at the end condition:** Handled by R4 priority ordering (Win > Kong/Pung > Chow; simultaneous *Hu* claims resolved by nearest player in turn order). - **A player with no legal move:** Not applicable; drawing, discarding, or passing on a claim is always legal. - **Repetition / cycles:** Tiles in the live wall decrease monotonically by at least 1 tile per turn cycle; infinite loops are impossible. - **Simultaneous claims on the same resource or position:** Deterministically resolved by the strict priority hierarchy in R4. - **Player elimination mid-round:** Not applicable; all 4 players remain active until a *Hu* or wall exhaustion occurs. - **Resource exhaustion:** Wall depletion triggers a formal draw (*Huangzhuang*) in R6. - **Termination guarantee:** Provably terminates within at most 70 draw cycles (the finite size of the tile wall). ## State representation - **Persistent state:** `scores[0..3]`, `dealer_seat (0..3)`, `round_wind`. - **Ephemeral state:** `wall_tiles` (hidden remaining sequence), `hand_tiles[0..3]` (private), `exposed_melds[0..3]` (public), `public_discards_history`, `active_seat`, `discard_in_play`. - **Observable information:** Partial information. Each player observes their own private 13-tile hand, all 4 players' public exposed melds, all face-up discard history, and remaining wall tile count. ## Action space - `draw_tile()`: Automated at start of turn. - `discard_tile(tile_id)`: Discard 1 tile from private hand. - `claim_chi(discard_tile, combo_tiles)`: Declare Chow sequence. - `claim_peng(discard_tile)`: Declare Pung triplet. - `claim_gang(discard_tile)`: Declare Kong quad. - `declare_hu(discard_or_self)`: Declare winning hand. - `pass_claim()`: Decline to claim discard. ## Playability notes - **Single-player-vs-AI:** Highly engine-ready; compatible with hidden-information MCTS, Information Set MCTS (IS-MCTS), or Deep Reinforcement Learning (e.g. Suphx-style models). - **Group games (n>4):** Strictly a 4-player game; additional players sit out and rotate seats after a full round (*Quan*). - **What is lost in the adaptation:** The physical shuffling sound of heavy bone tiles on felt tables, tactile finger reading (*mopai*), and rich banquet banter. ## Implementation hints Discretized tile array with 34 distinct tile types. Efficient hand verification requires recursive backtracking or dynamic programming / bitmask pattern lookup for 4×Meld+Pair combinations.

Download as JSON

Download the full game corpus entry for this game as structured JSON.

Download JSON
Cite this page

Sparrow Tiles (Mahjong) (China). (n.d.). Games of Countries. https://gamesofcountries.com/games/cn-china/majiang

@misc{gamesofcountries-cn-china-majiang,
  title = {Sparrow Tiles (Mahjong) (China)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/cn-china/majiang}
}