Formal Specification
Nine Pellets — Formal Specification
Kazakhstan · board-abstract · Confidence: high
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: directGap-fills: 4
# Togyzqumalaq — AI-optimized specification
## General idea
Togyzqumalaq is a two-player abstract strategy Mancala-family board game played on an 18-pit board with 162 pellets. Players take turns sowing pellets from one of their 9 pits in a counter-clockwise loop, capturing opponent pit contents when the final pellet produces an even total, or creating permanent single-pit sanctuaries (*tuzdyk*) on a final pellet totaling three. The game is purely deterministic, featuring deep combinatorial tactics and no hidden information.
## Formal model
- **Abstraction taken:** Direct representation. The traditional physical board (18 pits arranged in two rows of 9, plus 2 central reservoirs) translates 1-to-1 into a discrete array of integers and player bank states.
- **Player/agent count:** Exactly 2 agents (designated Player 1 / White and Player 2 / Black).
- **Turn model:** Strictly sequential alternating turns, beginning with Player 1.
## Formal rules
R1. **Board Layout and Initialization:**
- The board consists of 18 pits (*otau*), indexed 1 to 18 in counter-clockwise order: Player 1 controls pits 1..9 (left to right from Player 1's view); Player 2 controls pits 10..18 (pits 10 to 18 correspond to Player 2's pits 1 to 9 from right to left).
- Each pit starts with exactly 9 pellets (*qumalaq*). Total pellets on board = 162.
- Each player has a scoring reservoir (*qazan*), initially holding 0 pellets.
- Each player may hold at most one *tuzdyk* (sanctuary pit), initially unset (`null`).
- [gap-fill] Player 1 is chosen by a fair coin toss or predetermined schedule.
R2. **Turn Execution (Sowing):**
- The active player selects a pit on their own side that contains at least 1 pellet ().
- If : The single pellet is removed from pit () and placed into the adjacent pit .
- If : The player takes all pellets, leaves exactly 1 pellet in pit (), and sows the remaining pellets one by one into consecutive pits in cyclic order: , , ..., until all pellets are distributed.
R3. **Tuzdyk Auto-Capture:**
- During the sowing process (and upon move completion), whenever a pellet enters a pit designated as a player's *tuzdyk*, that pellet is immediately routed to the *tuzdyk* owner's *qazan* rather than remaining in the pit.
R4. **End-of-Sow Capture & Tuzdyk Declaration:**
- Let be the pit where the final pellet of the sowing lands.
- **Even Parity Capture:** If pit is on the opponent's side (not owned by the active player), is *not* a *tuzdyk*, and its new pellet count is an **even number**, the active player captures all pellets in pit : , and .
- **Tuzdyk Declaration:** If pit is on the opponent's side, is not currently a *tuzdyk*, the active player does not already own a *tuzdyk*, the opponent does not own a *tuzdyk* at the symmetrical pit number on the active player's side (i.e. if opponent owns pit , active player cannot claim pit ), pit is *not* the opponent's 9th pit (pit 9 for Player 2 or pit 18 for Player 1), and the final pellet brings pit 's total to **exactly 3 pellets**:
- The active player may (and in tournament rules, must) declare pit as their *tuzdyk*.
- All 3 pellets are transferred immediately to the active player's *qazan*, and pit is permanently marked as that player's *tuzdyk*.
- If none of the capture/tuzdyk conditions hold, the pellets remain in pit .
R5. **End Condition and Scoring:**
- **Majority Win:** If at any point , that player immediately wins the game.
- **Draw:** If both players reach exactly 81 pellets in their *qazan*, the game ends in a draw (*teis*).
- **Atsyrau (Immobilization):** If it is a player's turn to move and all 9 pits on their side are empty ( for all their pits), that player has no legal moves. The opponent takes all remaining pellets across all pits on the board and adds them to their own *qazan*. The final totals in both *qazan* are compared; the player with wins, or if 81–81, a draw.
- [gap-fill] If a position is repeated three times with the same player to move (threefold repetition) or 100 consecutive turns occur without a capture or tuzdyk creation, the game is declared a draw.
## Edge cases
- **Tie at the end condition:** Explicitly handled by R5 (81–81 score in *qazan* is an official draw / *teis*).
- **A player with no legal move:** Explicitly resolved by R5 (*atsyrau* rule): when a player has 0 pellets in all their pits, the opponent sweeps all remaining board pellets into their *qazan*, and final scores are evaluated.
- **Repetition / cycles (and the loop-breaking rule):** Handled by R5 [gap-fill] standard threefold repetition rule and 100-move no-capture rule resulting in a draw.
- **Simultaneous claims on the same resource or position:** Not applicable; turns are strictly sequential, and R4 forbids claiming a *tuzdyk* in the opponent's corresponding symmetrical index.
- **Player elimination mid-round; turn order repair:** Not applicable; strictly 2 players throughout.
- **Resource exhaustion (pieces, tokens, space, time):** Total pellet count is invariant at 162. Pits have unbounded capacity. Pellets only move between pits and *qazan*.
- **Termination guarantee: why the game provably ends:** Every capture and *tuzdyk* drop permanently removes pellets from cyclic pit circulation into scoring reservoirs. With 162 total pellets and finite state space bounded by the repetition/no-capture cap [gap-fill], infinite play is impossible.
## State representation
- **Persistent state:**
- `pits`: Array of 18 non-negative integers (indices 1..18).
- `qazan`: Array of 2 integers `[p1_score, p2_score]`.
- `tuzdyk`: Array of 2 nullable pit indices `[p1_tuzdyk, p2_tuzdyk]` (values 1..18 or `null`).
- `active_player`: Integer (1 or 2).
- `move_count`: Integer tracking total half-moves.
- `position_history`: Map of board hash to occurrence count (for repetition detection).
- **Per-turn ephemeral state:**
- `sown_pit`: Selected pit index.
- `final_pit`: Index of the pit where the last pellet landed.
- `captured_amount`: Number of pellets captured this turn.
- **Observable information:** Perfect information. Full board state, pit counts, reservoir scores, and *tuzdyk* ownership are completely visible to both agents.
## Action space
- `sow(pit_index)`:
- Parameter: `pit_index` if Player 1, or if Player 2.
- Precondition: `pits[pit_index] > 0`, and `pit_index` is not an opponent's *tuzdyk* (active player can sow from any non-empty pit on their side).
## Playability notes
- **Single-player-vs-AI:** Natural and standard. Alpha-beta minimax with bitboards or MCTS agents can be applied directly with zero rule modification.
- **Group games (n>4):** Not applicable; inherently a 2-player abstract duel.
- **Physical-skill games:** Not applicable; purely mental/algebraic calculation.
- **What is lost in the adaptation:** None. The discrete mechanics of Togyzqumalaq are fully captured with 100% fidelity.
## Implementation hints
- Board indexing: Use 0-indexed modular arithmetic () for the sowing loop. Remember that sowing leaves 1 pellet in the origin pit and sows steps, whereas moves the single pellet 1 step ahead leaving the origin pit empty.
- *Tuzdyk* routing: Whenever iterating through the sowing loop, check if the visited pit is owned as a *tuzdyk*; if so, increment the owner's *qazan* and do not increment `pits[i]`.
- Branching factor: At most 9 legal moves per turn (usually 3–7 as pits empty). Highly suitable for evaluation search.
- First milestone: Implement board data structure, cyclic sowing function, even-capture parity check, and verify against standard opening lines.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Nine Pellets (Kazakhstan). (n.d.). Games of Countries. https://gamesofcountries.com/games/kz-kazakhstan/togyzqumalaq
@misc{gamesofcountries-kz-kazakhstan-togyzqumalaq,
title = {Nine Pellets (Kazakhstan)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/kz-kazakhstan/togyzqumalaq}
}