Skip to main content
Formal Specification

Nine Stones (Mancala) — Formal Specification

Uzbekistan · board-abstract · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 2
# To'qqiz tosh — AI-optimized specification ## General idea To'qqiz tosh (Nine Stones) is a deep, two-player perfect-information abstract strategy board game of the mancala family. Played with 162 pieces distributed across two opposing rows of nine pits with central capture cauldrons, players sow pieces counter-clockwise to capture even-numbered sums in opponent pits and strategically establish permanent "Tuz" tributary pits. Structurally distinct from African mancala variants (Oware) or Kalah, starting pits retain one piece during multi-piece sowings, captures require even sums exclusively, and a captured Tuz pit diverts all future passing pieces to its owner. ## Formal model - **Abstraction taken:** None required; the traditional game rules constitute a fully discrete, deterministic mathematical system. - **Player/agent count:** Exactly 2 agents (P1,P2). - **Turn model:** Strictly alternating sequential turns (P1→P2→P1…). ## Formal rules R1. **Board Setup & Initial State:** - 18 pits arranged in two rows of 9: pits 1…9 belong to P1, pits 10…18 belong to P2 (where pit 10 is opposite pit 9, and pit 18 is opposite pit 1). - Initial pieces: pits[i]=9 for all i∈{1…18} (162 pieces total). - Cauldrons: qozon[P1]=0,qozon[P2]=0. - Tuz markers: tuz[P1]=None,tuz[P2]=None. - Active player starts as P1. R2. **Sowing Mechanics (Yurish):** - Active player Pk selects an owned pit p where pits[p]>0 and p≠tuz[P3−k]. - Sowing count C=pits[p]. - **Case A (C>1):** pits[p]←1; remaining C−1 pieces are sown one by one into consecutive pits in counter-clockwise cyclic order (p+1,p+2,⋯mod18). - **Case B (C==1):** pits[p]←0; the single piece is placed into (pmod18)+1. - During sowing, if a piece is placed into a pit j that is designated as tuz[Powner], that piece is immediately removed from the pit and added to qozon[Powner]. R3. **Capture Evaluation (Qozonga tushirish):** - Let plast be the pit receiving the final sown piece. - If plast belongs to the opponent (P3−k) and is not a Tuz: - **Even-Count Capture:** If pits[plast]mod2==0, all pieces in plast are captured: qozon[Pk]←qozon[Pk]+pits[plast] pits[plast]←0 - **Tuz Creation Declaration:** If pits[plast]==3 **AND** tuz[Pk]==None **AND** plast≠opponent’s 9th pit **AND** plast≢tuz[P3−k] (not symmetrical mirror pit), Pk may declare plast as their permanent tuz[Pk]. All 3 pieces in plast are immediately moved to qozon[Pk]. R4. **Victory Conditions:** - **Majoritarian Threshold:** If at any point qozon[Pk]≥82, player Pk immediately wins the match. - **Exact Tie:** If both players collect exactly qozon[P1]=81 and qozon[P2]=81, the game is declared a draw (*durang*). R5. **Impassable Turn / Starvation (Atsyz qolish):** - If on active player Pk's turn, all 9 pits belonging to Pk have 0 pieces (and no legal sowing moves exist): - All remaining pieces resting in the opponent's pits are immediately swept into the opponent's cauldron: qozon[P3−k]←qozon[P3−k]+∑pits - Final scores are compared per R4. R6. [gap-fill] Loop-Breaking Draw Rule:** - If the exact same board state (pit piece counts, cauldrons, and Tuz locations) repeats 3 times, or if 150 consecutive plies occur without any capture, the game is declared a draw. ## Edge cases - **Tie at the end condition:** Exactly 81–81 piece score produces a formal draw (R4.2). - **A player with no legal move:** Resolved via R5 (starvation rule sweeps remaining pieces to opponent). - **Repetition / cycles:** Bounded strictly by R6 (threefold repetition or 150-ply non-capture limit) [gap-fill]. - **Simultaneous claims on the same resource or position:** Not applicable; turns are strictly sequential. - **Player elimination mid-round:** Not applicable; 1v1 discrete abstract game. - **Resource exhaustion:** The 162 pieces are conserved invariant; total pieces across pits and cauldrons always equals 162. - **Termination guarantee:** Guaranteed by monotonic piece absorption into cauldrons towards the 82-piece threshold and the 150-ply non-capture loop-breaking cap. ## State representation - **Persistent state:** - Board array: pits∈ℕ18. - Cauldrons: qozon1,qozon2∈{0…162}. - Tuz slots: tuz1,tuz2∈{1…18}∪{None}. - Active player index: k∈{1,2}. - Ply counter t, state repetition history hash set. - **Per-turn ephemeral state:** - Chosen pit index p. - Final landing pit plast. - Pieces captured in turn Δqozon. - **Observable information:** - Perfect information: complete board state, pit counts, cauldrons, and Tuz positions are fully visible to both players. ## Action space - `sow(pit_index)`: Parameters: `pit_index` ∈{1…9} (for P1) or {10…18} (for P2). Precondition: pits[pit_index]>0 and pit_index≠tuz[Popponent]. - `declare_tuz(pit_index)`: Optional/automatic flag combined with `sow` when landing pit creates exactly 3 pieces under valid conditions. ## Playability notes - **Single-player-vs-AI:** Natural. An ideal domain for Minimax, Alpha-Beta pruning, and Monte Carlo Tree Search (MCTS) agents. - **Group games reduction:** Inherently a 2-player game. - **Physical-skill games:** Not applicable (pure mathematical abstract). - **What is lost:** Tactile stone clicking on carved wooden board hollows, and pastoral wooden board aesthetics. ## Implementation hints - Represent board as an array of 18 integers with counter-clockwise indexing: `0..8` for Player 1, `9..17` for Player 2. - Efficiently implement single-piece vs multi-piece sowing branches in the state transition function. - Average branching factor: ≈5 to 8 legal moves per turn. - First milestone: Implement full legal move generation, counter-clockwise sowing, and even-capture logic, validating that sum of all pieces always equals 162.

Download as JSON

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

Download JSON
Cite this page

Nine Stones (Mancala) (Uzbekistan). (n.d.). Games of Countries. https://gamesofcountries.com/games/uz-uzbekistan/toqqiz-tosh

@misc{gamesofcountries-uz-uzbekistan-toqqiz-tosh,
  title = {Nine Stones (Mancala) (Uzbekistan)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/uz-uzbekistan/toqqiz-tosh}
}