Formal Specification
Swahili Royal 4-Row Mancala — Formal Specification
Kenya · board-abstract · Confidence: high
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: directGap-fills: 2
# Bao (Bao la Kiswahili) — AI-optimized specification
## General idea
A 4x8 mancala game with two phases: an opening seed-placement phase (Namua) followed by
a relay-sowing and capture phase (Mtaji), played on a board with a special "house" pit
per player.
## Formal model
- **Abstraction taken:** none needed beyond the source — Bao is already a discrete board
game with a fully defined state (pit contents) and legal-move set.
- **Player/agent count:** 2.
- **Turn model:** strictly alternating turns.
## Formal rules
R1. Board: 2 players x 2 rows x 8 pits = 32 pits total. Row nearest the opponent is the
"front row"; the row behind it is the "back row." Pit 5 (from the left) of each player's
front row is the Nyumba (house).
R2. Setup: one attested convention (Zanzibar/Tanzania coast; not confirmed Kenya-specific
— see entry Sources #3) starts each player with 8 seeds already on the board (6 in the
Nyumba, 2 distributed across two other front-row holes) and the remaining 24 seeds held
in reserve for the Namua phase. [gap-fill: whether this exact split is used uniformly on
the Kenyan coast, versus other regional starting conventions, is undocumented]
R3. Namua phase: on each turn, a player must place one reserve seed into an empty pit in
their own front row, UNLESS that placement would create an immediate capture (see R5),
in which case a capturing placement is mandatory when available. Namua ends for a player
once their reserve is exhausted.
R4. Mtaji phase (entered once both players have exhausted their Namua reserve, or earlier
per R3's forced-capture rule): on each turn, select a non-empty pit with 2+ seeds on your
own side and relay-sow its contents one seed per pit, counter-clockwise, continuing into
a new lap from any pit where the last seed lands in an already-occupied pit.
R5. Capture: a sowing move captures when its final seed lands in an empty front-row pit
of the mover, directly opposite an occupied enemy front-row pit. The mover takes both
that enemy front-row pit's seeds and the enemy back-row pit directly behind it, and sows
them onward from the capturing pit.
R6. Win condition: a player loses when they hold no legal move — i.e., their front row is
empty of capturable material and no pit has 2+ seeds to sow.
## Edge cases
- **Tie at the end:** unaddressed in source; player with no legal move loses immediately, so a tie does not occur in normal play.
- **A player with no legal move:** in Mtaji, the player with no legal move loses immediately (R6); no pass mechanic exists.
- **Repetition / cycles:** relay-sowing can in principle cycle; not formally proven to terminate in general, so implementers should impose a move-count cap as a safety bound.
- **Simultaneous claims on one position:** [gap-fill: source does not specify a tie-break when multiple capture placements are available in Namua; implementers should require the player to choose among legal capturing placements].
- **Elimination mid-round and turn-order repair:** not applicable; two-player game with no player elimination; pieces captured into player banks.
- **Resource exhaustion:** seeds on the board deplete into captured banks over time.
- **Termination guarantee:** not formally guaranteed in the general case — mancala games with relay sowing can in principle cycle, though captures steadily reduce material in practice; implementers should impose a move-count cap as a safety bound.
## State representation
- `board`: array[2][2][8] of seed counts (player, row, pit).
- `reserve`: array[2] of int — seeds not yet placed (Namua phase only).
- `phase`: enum {namua, mtaji}, tracked per player (a player can enter Mtaji while the
opponent is still in Namua).
- `to_move`: player index.
## Action space
- `place_reserve(pit)` — Namua phase: place one reserve seed into empty front-row `pit`.
- `sow(pit)` — Mtaji phase: sow all seeds from a front- or back-row `pit` holding 2+
seeds.
## Playability notes
- This is a deterministic, perfect-information combinatorial game — directly suited to
minimax/MCTS search with no probabilistic modeling needed.
- Branching factor is small in Namua (≤8 empty front-row pits) and moderate in Mtaji
(bounded by non-empty own-side pits, ≤16).
- Nothing physical is lost in adaptation; Bao is already an abstract board game.
## Implementation hints
Implement Mtaji's relay-sow and capture logic first and test it against known short game
transcripts before adding the Namua opening phase, since Namua's forced-capture rule
(R3) depends on being able to simulate a hypothetical placement's Mtaji-style capture
check.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Swahili Royal 4-Row Mancala (Kenya). (n.d.). Games of Countries. https://gamesofcountries.com/games/ke-kenya/bao-la-kiswahili
@misc{gamesofcountries-ke-kenya-bao-la-kiswahili,
title = {Swahili Royal 4-Row Mancala (Kenya)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/ke-kenya/bao-la-kiswahili}
}