Formal Specification
Encirclement Chess (Go) — Formal Specification
China · board-abstract · Confidence: low
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: directGap-fills: 3
# Weiqi — AI-optimized specification
## General idea
A deterministic two-player abstract strategy board game of territorial encirclement played on the 361 intersections of a 19×19 grid. Players alternate placing black and white stones to surround empty intersections (territory) and capture opponent stone clusters by depriving them of all orthogonal adjacent liberties (*qi*). The game concludes after consecutive passes, with the winner determined by Chinese area scoring (*shuzifa*), where living stones plus enclosed empty intersections are tallied, balanced by a komi compensation for White.
## Formal model
- **Abstraction taken:** None; formalizes the complete discrete combinatorial rules of Chinese Weiqi (*Shuzifa*).
- **Player/agent count:** 2 players (Black vs. White).
- **Turn model:** Sequential alternating turns; Black moves first.
## Formal rules
R1. Board & Stones: A 19×19 grid with 361 intersections where . Black starts with 181 stones, White with 180 stones.
R2. On a turn, the active player must select exactly one legal action: `place_stone(row, col)` on an unoccupied intersection or `pass_turn()`.
R3. Liberties & Group Connectivity:
- Two stones of the same color are connected if they are adjacent along an orthogonal grid line. A connected set of friendly stones forms a single group.
- The orthogonal vacant intersections adjacent to a group are its **liberties** (*qi*).
R4. Capturing: If a stone placement reduces an opponent group's liberties to 0, that entire opponent group is immediately captured, removed from the board, and set aside.
R5. Suicide Prohibition: A player cannot place a stone on an intersection that leaves the placed stone or its resulting group with 0 liberties, unless that move simultaneously executes a capture of one or more adjacent opponent groups.
R6. Ko Rule (*Jie* / 劫): A player may not make a move that recreates the exact whole-board position from the previous turn (situational ko). If a single stone is captured in a ko shape, the capturing player must play at least one move elsewhere (*ko threat*) before recapturing.
R7. Game Conclusion: Play terminates when both players execute `pass_turn()` consecutively.
R8. Scoring (Chinese Area Scoring / *Shuzifa*):
- Unconditionally dead stones within opposing territory are removed from the board.
- Each player tallies their controlled area: the number of living stones on the board plus the number of surrounded vacant intersections (*zi kong jie di*).
- White receives a komi compensation allowance of (equivalent to ) to offset Black's first-move advantage.
- The player with the higher total score wins.
R9. [gap-fill] Superko Rule: Any board position that has appeared previously at any point in the match with the same player to move is illegal, preventing long multi-step cyclic repetitions (triple ko, quadruple ko).
R10. [gap-fill] Hard Move Limit: If 400 total half-moves elapse without consecutive passes, play terminates immediately and the board is scored based on current living stones and enclosed territory.
R11. [gap-fill] Territory Resolution Adjudication: If players dispute the life/death status of stones upon consecutive passes, play resumes until disputes are resolved by direct tactical capture or defense.
## Edge cases
- **Tie at the end condition:** Fractional komi (+7.5 points) guarantees no integer score ties are possible.
- **A player with no legal move:** `pass_turn()` is always legal. If both players pass, the game transitions to scoring.
- **Repetition / cycles:** Prevented by the Superko rule (R9) and the 400-move limit (R10).
- **Simultaneous claims on the same resource or position:** Not applicable; strictly sequential turns.
- **Player elimination mid-round:** Not applicable (2-player full match).
- **Resource exhaustion:** Board intersections are finite (361 points); captured stones do not re-enter the game.
- **Termination guarantee:** Provably terminates within 400 half-moves by R10.
## State representation
- **Persistent state:** `board[19][19]` storing `{Empty, Black, White}`, `turn_count`, `consecutive_passes (0..2)`, `zobrist_history_hash_set`.
- **Per-turn state:** `active_color`, `ko_point`, `captured_stones_count`.
- **Observable information:** Perfect information, fully observable.
## Action space
- `place_stone(row, col)`: Place stone on legal empty intersection (not violating suicide or superko).
- `pass_turn()`: Forfeit active turn.
## Playability notes
- **Single-player-vs-AI:** Highly engine-ready; compatible with AlphaGo/KataGo style deep reinforcement learning and MCTS algorithms.
- **Group games (n>4):** Not applicable (pure 2-player abstract).
- **What is lost in the adaptation:** None; full mathematical preservation of traditional discrete game rules.
## Implementation hints
Standard grid representation. Maintain group liberty counting via disjoint-set union (Union-Find) or flood-fill bitboards. Use Zobrist hashing for efficient Superko board state history lookups.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Weiqi (China). (n.d.). Games of Countries. https://gamesofcountries.com/games/cn-china/weiqi
@misc{gamesofcountries-cn-china-weiqi,
title = {Weiqi (China)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/cn-china/weiqi}
}