Skip to main content
Formal Specification

Mangala (Turkish Mancala / Transfer Game) — Formal Specification

Türkiye · board-abstract · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 1
# Mangala — AI-optimized specification ## General idea Mangala is a deterministic, perfect-information two-player mancala game played on a 2x6 board with two dedicated treasuries using 48 stones. It is distinguished by three core mechanics: an active player leaves a stone in the source pit if moving multiple stones, earns an immediate free turn if the final stone lands in their own treasury, and captures stones either by making an opponent's pit count even or by landing in an empty friendly pit opposite an occupied enemy pit. ## Formal model - **Abstraction taken:** None required (`fidelity_class: direct`). The traditional board state and sowing mechanics form a discrete mathematical system. - **Player/agent count:** 2 agents, designated Agent 0 (South) and Agent 1 (North). - **Turn model:** Sequential turns with conditional extra moves (chaining free turns upon landing in one's own treasury). ## Formal rules R1. The board consists of 14 discrete positions indexed 0..13: - Agent 0 pits: 0..5 (left to right from Agent 0's perspective). - Agent 0 treasury: index 6. - Agent 1 pits: 7..12 (left to right from Agent 1's perspective, corresponding to 12..7 counter-clockwise). - Agent 1 treasury: index 13. R2. Initial state: pits 0..5 and 7..12 contain exactly 4 stones each; treasuries 6 and 13 contain 0 stones. Total stones = 48. R3. Legal actions on Agent `p`'s turn: Select any friendly pit index `i` (where `i ∈ [0..5]` for `p=0`, `i ∈ [7..12]` for `p=1`) such that `count(i) > 0`. R4. Sowing procedure: - If `count(i) == 1`: remove the stone, set `count(i) = 0`, and place that 1 stone into `(i + 1) mod 14` (skipping opponent's treasury). - If `count(i) > 1`: remove `K = count(i)` stones, leave 1 stone at `i` (so `count(i) = 1`), and sow the remaining `K - 1` stones one by one into subsequent pits advancing counter-clockwise `(curr + 1) mod 14`. If the next position is the opponent's treasury (`13` if `p=0`, `6` if `p=1`), skip it and place into the following pit. R5. Last stone resolution (where `L` is the landing index of the final sown stone): - Case 1 (Treasury Landing): If `L == treasury(p)`, Agent `p` receives an extra turn. If the game has not ended, Agent `p` acts again. - Case 2 (Even Opponent Capture): If `L` is an opponent's pit and `count(L)` is an even integer (`count(L) % 2 == 0`), Agent `p` takes all stones from pit `L` (including the newly placed stone) and adds them to `treasury(p)`, leaving `count(L) = 0`. - Case 3 (Friendly Empty Capture): If `L` is a friendly pit and was empty prior to the last stone arriving (i.e. `count(L) == 1` after placement), and the directly opposite opponent pit `opp(L) = 12 - L` has `count(opp(L)) > 0`, Agent `p` captures both the 1 stone at `L` and all stones at `opp(L)`, placing them into `treasury(p)`, leaving `count(L) = 0` and `count(opp(L)) = 0`. - Case 4 (Neutral Landing): If none of Cases 1–3 apply, turn ends. R6. End condition: If after any move or capture all friendly pits of Agent `p` are empty (sum of stones in friendly pits == 0), the game terminates immediately. All stones remaining in the opponent's pits are swept into Agent `p`'s treasury [gap-fill: explicitly verified by national federation codification]. R7. Win condition: Agent with `count(treasury(p)) > 24` wins. If both treasuries hold exactly 24 stones, the game is a draw. ## Edge cases - **Tie at the end condition:** Handled directly by R7 — exactly 24 stones in each treasury is a formal draw. - **A player with no legal move:** When a player's side is completely empty, R6 triggers immediate game termination and sweeping of all remaining stones to that player; no deadlock state exists. - **Repetition / cycles:** Because every capture and treasury deposit permanently reduces stones circulating in small pits, stone pool strictly shrinks monotonically into treasuries, making infinite cycles mathematically impossible without eventual exhaustion. - **Simultaneous claims on the same resource or position:** Not applicable; turns are strictly sequential. - **Player elimination mid-round:** Not applicable; 2-player zero-sum abstract game. - **Resource exhaustion:** Total stone count is invariant at 48. All stones eventually transfer to treasuries. - **Termination guarantee:** Each capture and treasury drop reduces active board stones. A finite game graph with no cycles guarantees termination in at most ~150 moves. ## State representation - Persistent state: - `board: Array[14] of integer` (pit counts 0..13). - `active_player: integer` (0 or 1). - `game_over: boolean`. - `winner: integer` (-1 for ongoing/draw, 0 or 1 for winner). - Ephemeral state: - `last_landing_index: integer`. - `extra_turn_granted: boolean`. - Information set: Fully observable by both agents (perfect information, no randomness). ## Action space - `sow_pit(pit_index)`: integer `pit_index` in `[0..5]` for Player 0 or `[7..12]` for Player 1, valid only if `board[pit_index] > 0`. Max branching factor = 6. ## Playability notes - Single-player-vs-AI: Engine-ready; standard Minimax / Alpha-Beta or MCTS achieves superhuman evaluation readily. - Group games: Not applicable (2-player duel). - Physical-skill games: Not applicable (discrete abstract strategy). - What is lost: Tactile dexterity of flicking stones smoothly into wooden cups. ## Implementation hints Very low complexity. State fits into 14 bytes (or two 64-bit integers). Branching factor is at most 6 per step. First milestone: implement board array and R4 sowing logic with unit tests for the three distinct capture/treasury triggers.

Download as JSON

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

Download JSON
Cite this page

Mangala (Turkish Mancala / Transfer Game) (Türkiye). (n.d.). Games of Countries. https://gamesofcountries.com/games/tr-turkiye/mangala

@misc{gamesofcountries-tr-turkiye-mangala,
  title = {Mangala (Turkish Mancala / Transfer Game) (Türkiye)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/tr-turkiye/mangala}
}