Skip to main content
Formal Specification

Khmer Mancala (Counting Rice Pits) — Formal Specification

Cambodia · board-abstract · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 2
# Bay Khom — AI-optimized specification ## General idea A deterministic 2-player Mancala game played on a 10-pit circuit with continuous multi-lap relay sowing. When the last seed falls into an occupied pit, the lap continues; when it lands before a single empty pit, all seeds in the pit immediately beyond the empty pit are captured. The game terminates when all pits are cleared. ## Formal model - **Abstraction taken:** None — direct formalization of standard rules. - **Player/agent count:** 2 agents (P0,P1). - **Board Topology:** Directed 10-node cycle 0→1→⋯→9→0. Pits 0..4 belong to P0; pits 5..9 belong to P1. Each player has a private score storehouse (S0,S1). - **Turn model:** Sequential, alternating. ## Formal rules R1. Setup: Pits 0..9 each start with 4 seeds. Storehouses S0=1,S1=1 (Total seeds = 42). R2. Legal Move: Active player Pk selects a pit i belonging to their side with `seeds[i] > 0`. R3. Relay Sowing Loop: - Hand holds `seeds[i]`; `seeds[i] = 0`; current pit index c←i. - While `hand > 0`: - c←(c+1)(mod10). - `seeds[c] += 1`; `hand -= 1`. - Upon `hand == 0` at landing pit c: - Case A (Relay): If `seeds[c] > 1`, scoop all seeds: `hand += seeds[c]`; `seeds[c] = 0`; continue loop. - Case B (Capture): If `seeds[c] == 1` (landing was previously empty): - Inspect next pit n1=(c+1)(mod10). - If `seeds[n1] == 0`: - Inspect pit n2=(n1+1)(mod10). - If `seeds[n2] > 0`: Player captures all seeds from n2: Sk←Sk+seeds[n2]; seeds[n2]←0. - [Chain capture]: Repeat check for (n2+1) empty and (n2+2) occupied. - Turn ends. - If `seeds[n1] > 0`: Turn ends without capture. - Case C (Khveang): If landing on empty and both n1 and n2 are empty: Turn ends immediately. R4. [gap-fill] Seed Starvation: If at the start of Pk's turn all pits on their side have 0 seeds, Pk must seed 1 token from Sk into each of their 5 pits. If Sk<5, distribute remaining tokens; if Sk==0, Pk passes turn. R5. Win condition: When ∑i=09seeds[i]==0, game ends. The agent with Sk>21 wins. If S0=S1=21, game is a draw. R6. [gap-fill] Hard Move Limit: If 200 turns elapse without a capture, the player with the higher current storehouse Sk wins. ## Edge cases - **Tie at the end condition:** S0=S1=21 is a valid draw. - **A player with no legal move:** Governed by R4 (replenish from storehouse or pass). - **Repetition / cycles (and the loop-breaking rule):** Bounded by monotonic capture to storehouses and R6 turn limit. - **Simultaneous claims on the same resource or position:** Not applicable — turns are sequential. - **Player elimination mid-round; turn order repair:** Not applicable — 2-player game. - **Resource exhaustion:** Total token mass is invariant (42=∑seeds+S0+S1). - **Termination guarantee: why the game provably ends:** Guaranteed by finite seed mass and R6 turn cap. ## State representation - `pits`: array of 10 integers (seed counts per pit). - `storehouse_0`, `storehouse_1`: integer score totals. - `active_player`: ∈{0,1}. - `turn_count`: integer. - Observable information: Fully observable by both agents. ## Action space - `select_pit(pit_index)`: where `pit_index` ∈{0..4} for P0 (or {5..9} for P1) and `pits[pit_index] > 0`. ## Playability notes - **Single-player-vs-AI:** Directly engine-ready for Alpha-Beta search, Minimax, or MCTS. - **Group games (n>4):** Not applicable; purely a 2-player game. - **What is lost:** Nothing — 100% direct discrete representation. ## Implementation hints Branching factor is at most 5 moves per turn (usually 2–4). Entire game engine can be written in under 60 lines of code. Excellent candidate for automated evaluation.

Download as JSON

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

Download JSON
Cite this page

Khmer Mancala (Counting Rice Pits) (Cambodia). (n.d.). Games of Countries. https://gamesofcountries.com/games/kh-cambodia/bay-khom

@misc{gamesofcountries-kh-cambodia-bay-khom,
  title = {Khmer Mancala (Counting Rice Pits) (Cambodia)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/kh-cambodia/bay-khom}
}