Skip to main content
Formal Specification

Elephant Chess (Chinese Chess) — Formal Specification

China · board-abstract · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 3
# Xiangqi — AI-optimized specification ## General idea A deterministic two-player abstract strategy board game simulating a battle between two armies across a central dividing River (*Chuhe Hanjie*). Played on the 90 intersections of a 9×10 grid, players maneuver 16 pieces each—including jumping Cannons, palace-restricted Generals and Advisors, leaping Horses subject to leg-blocking, and boundary-limited Elephants—to checkmate (*jiangsi*) or stalemate (*kunsibi*) the opposing General. ## Formal model - **Abstraction taken:** None required; complete discrete board game with codified competitive movement and tournament capture rules. - **Player/agent count:** 2 players (Red vs. Black). - **Turn model:** Sequential alternating turns; Red moves first. ## Formal rules R1. Board Geography: A 9-column by 10-row grid of 90 intersections (r,c) where r∈[1,10],c∈[1,9]. The board is bisected between rows 5 and 6 by the River (*Chuhe Hanjie*). Rows 1–3, cols 4–6 form the Red Nine Palace (*Jiu Gong*); rows 8–10, cols 4–6 form the Black Nine Palace. R2. Piece Arsenal: 16 pieces per player: - **General (帅/将, 1):** Moves 1 step orthogonally within its home Nine Palace. Cannot face the opposing General along the same unobstructed vertical column without intervening pieces ("Flying General" rule). - **Advisor (仕/士, 2):** Moves 1 step diagonally within its home Nine Palace. - **Elephant (相/象, 2):** Moves exactly 2 steps diagonally (2×2 field shape); cannot cross the River. Movement is blocked if an intervening piece occupies the center intersection ("blocking elephant eye" / *sai xiangyan*). - **Horse (傌/马, 2):** Moves 1 step orthogonally plus 1 step diagonally outward; blocked if an intervening piece occupies the adjacent orthogonal step ("hobbling horse leg" / *bie matui*). - **Chariot (俥/车, 2):** Moves any distance along unobstructed orthogonal lines. - **Cannon (炮/砲, 2):** Moves like a Chariot when traversing without capture; captures an opposing piece along orthogonal lines by jumping over exactly one intervening piece of either color ("screen" / *paojia*). - **Soldier (兵/卒, 5):** Moves 1 step forward until crossing the River. Once across the River, may move 1 step forward or 1 step horizontally left/right. Soldiers never move backward. R3. Capturing: Moving a piece onto an intersection occupied by an opposing piece captures and removes that piece from the board. R4. Check and Checkmate: - When a player's General is under direct attack (*jiangjun*), that player must make a legal move to eliminate the threat. - If no legal move exists to escape check, the General is **Checkmated** (*Jiangsi*) and the attacking player wins immediately. R5. Stalemate (*Kunsibi*): If a player on their turn has no legal moves and is not in check, that player immediately loses the game. R6. Perpetual Check & Chase Bans: - A player is strictly prohibited from delivering perpetual check (*changshen*) or perpetual chase of an unprotected piece. Repeating such moves requires the attacking player to alter their move; failure to do so results in forfeiture. R7. [gap-fill] Threefold Repetition Draw: If an identical board position and turn order occurs three times in mutually harmless moves (neither perpetual check nor chase), the game is declared an immediate draw. R8. [gap-fill] 60-Move Rule: If 60 full moves (120 half-moves) elapse without a piece capture or check, either player may claim a draw. R9. [gap-fill] Maximum Match Move Cap: If 200 total full moves elapse without checkmate, the game is declared a draw. ## Edge cases - **Tie at the end condition:** Possible via R7 (threefold repetition), R8 (60-move rule without capture), or R9 (200-move cap). - **A player with no legal move:** Stalemate (*Kunsibi*) results in an immediate loss for the stalemated player (R5). - **Repetition / cycles:** Governed by R6 (perpetual check/chase bans) and R7 (threefold repetition). - **Simultaneous claims on the same resource or position:** Not applicable; strictly sequential alternating turns. - **Player elimination mid-round:** Not applicable (2-player match). - **Resource exhaustion:** Captured pieces are permanently removed from play. - **Termination guarantee:** Provably terminates within 200 full moves by R9. ## State representation - **Persistent state:** `board[10][9]` storing `{Empty, (owner, piece_type)}`, `turn_count`, `moves_since_capture`, `position_history_table`. - **Per-turn state:** `active_color`, `in_check_flag`, `legal_moves_list`. - **Observable information:** Perfect information, fully observable. ## Action space - `move_piece(from_r, from_c, to_r, to_c)`: Execute valid piece movement or capture. ## Playability notes - **Single-player-vs-AI:** Highly engine-ready; compatible with Alpha-Beta search, bitboard engines (e.g. Pikafish, Eleeye), or NNUE evaluation networks. - **Group games (n>4):** Not applicable (pure 2-player abstract). - **What is lost in the adaptation:** None; complete mathematical representation of official Xiangqi rules. ## Implementation hints Standard 9×10 board array or 90-bit integer bitboards. Implement strict path validation for Horse leg hobbling (*bie matui*), Elephant eye blocking (*sai xiangyan*), and Cannon screen jumping (*paojia*).

Download as JSON

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

Download JSON
Cite this page

Xiangqi (China). (n.d.). Games of Countries. https://gamesofcountries.com/games/cn-china/xiangqi

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