Formal Specification
Khmer Mancala (Counting Rice Pits) — Formal Specification
Cambodia · board-abstract · Confidence: low
← Back to game pageImplementation 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 ().
- **Board Topology:** Directed 10-node cycle . Pits belong to ; pits belong to . Each player has a private score storehouse ().
- **Turn model:** Sequential, alternating.
## Formal rules
R1. Setup: Pits each start with 4 seeds. Storehouses (Total seeds = 42).
R2. Legal Move: Active player selects a pit belonging to their side with `seeds[i] > 0`.
R3. Relay Sowing Loop:
- Hand holds `seeds[i]`; `seeds[i] = 0`; current pit index .
- While `hand > 0`:
- .
- `seeds[c] += 1`; `hand -= 1`.
- Upon `hand == 0` at landing pit :
- 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 .
- If `seeds[n1] == 0`:
- Inspect pit .
- If `seeds[n2] > 0`: Player captures all seeds from : ; .
- [Chain capture]: Repeat check for empty and occupied.
- Turn ends.
- If `seeds[n1] > 0`: Turn ends without capture.
- Case C (Khveang): If landing on empty and both and are empty: Turn ends immediately.
R4. [gap-fill] Seed Starvation: If at the start of 's turn all pits on their side have 0 seeds, must seed 1 token from into each of their 5 pits. If , distribute remaining tokens; if , passes turn.
R5. Win condition: When , game ends. The agent with wins. If , game is a draw.
R6. [gap-fill] Hard Move Limit: If 200 turns elapse without a capture, the player with the higher current storehouse wins.
## Edge cases
- **Tie at the end condition:** 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 ().
- **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`: .
- `turn_count`: integer.
- Observable information: Fully observable by both agents.
## Action space
- `select_pit(pit_index)`: where `pit_index` for (or for ) 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 JSONCite 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}
}