Formal Specification
Olinda Seed Game — Formal Specification
Sri Lanka · board-abstract · Confidence: high
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: directGap-fills: 3
# Olinda Keliya — AI-optimized specification
## General idea
Olinda Keliya is an ancient Sri Lankan two-player Mancala board game played on a carved wooden board with fourteen playing pits (two rows of seven) and two storage storehouses. Players lift red-and-black *olinda* seeds from pits on their own side, distribute them sequentially in counter-clockwise multi-lap sowing, and execute cascading captures (*kāvā*) when the final seed of a sowing lap lands immediately before an empty pit followed by an occupied pit.
## Formal model
- **Abstraction taken:** Direct discrete formalization on a circular array of 14 pits `P[0..13]`, where Player 0 owns pits `0..6` (South row) and Player 1 owns pits `7..13` (North row), plus 2 score stores `Store[0]` and `Store[1]`. Total seed count is conserved at 56 seeds.
- **Player/agent count:** Exactly 2 players (Player 0 and Player 1).
- **Turn model:** Strictly sequential alternating turns with multi-lap sowing execution.
## Formal rules
R1. Setup:
- 14 playing pits: `P[0..13]`. Each pit is initialized with exactly 4 seeds (`P[i] = 4` for all `i in {0..13}`).
- Storehouses: `Store[0] = 0`, `Store[1] = 0`.
- Total seeds in play = 56.
- Sowing direction is counter-clockwise: pit index advances `i -> (i + 1) mod 14`.
R2. Turn Initiation & Sowing:
- On their turn, the active player selects a pit `h` on their own side of the board containing `P[h] > 0` (Player 0 selects `h in 0..6`; Player 1 selects `h in 7..13`).
- The player picks up all `S = P[h]` seeds from pit `h` (`P[h] = 0`).
- The player sows seeds one by one into consecutive pits: `current_pit = (h + 1) mod 14`, dropping 1 seed into each pit until hand is empty.
R3. Multi-Lap Continuation:
- When the last seed drops into pit `end_pit`:
- If `P[end_pit] > 1` (the pit was occupied before the drop, now has `>= 2` seeds):
- The player immediately picks up all seeds from `end_pit` (`P[end_pit] = 0`) and continues sowing without pause in the same direction.
R4. Capture Condition (*Kāvā*):
- When the last seed of a sowing lap drops into pit `end_pit` such that `P[end_pit] == 1` (the pit was previously empty):
- Check the immediately adjacent next pit: `next_1 = (end_pit + 1) mod 14`.
- If `P[next_1] == 0` (the adjacent pit is empty):
- Check pit `next_2 = (next_1 + 1) mod 14`.
- If `P[next_2] > 0`: The player captures all seeds in `next_2`. `Store[active_player] += P[next_2]`, `P[next_2] = 0`.
- *Cascading Capture:* Check `next_3 = (next_2 + 1) mod 14` and `next_4 = (next_3 + 1) mod 14`. If `P[next_3] == 0` and `P[next_4] > 0`, capture `P[next_4]`. Repeat until a pit pair fails the empty-occupied pattern.
- If `P[next_1] > 0`: No capture occurs; the turn ends (*Pussa*), and play passes to the opponent.
R5. Protected Hole Rule (*Puwak-gediya*):
- [gap-fill] If any pit accumulates exactly 4 seeds during sowing, the pit owner may claim these seeds into their storehouse at the conclusion of that sowing lap.
R6. Turn Passing & Game Termination:
- If a player has 0 seeds across all 7 pits on their side at the start of their turn, they must pass their turn.
- The game terminates when:
- All 56 seeds have been captured into storehouses (`Store[0] + Store[1] == 56`), or
- [gap-fill] No further captures are mathematically possible; any remaining seeds on the board are swept into the storehouse of the player on whose side they reside.
R7. Win Condition:
- The player with the higher total seed count in their storehouse wins (`Store[active] > 28`).
## Edge cases
- Tie at the end condition: If both players capture exactly 28 seeds (`Store[0] == 28` and `Store[1] == 28`), the game is a draw.
- A player with no legal move: If all pits on a player's side are empty, the player passes; the opponent continues playing until seeds enter the empty side or all seeds are captured.
- Repetition / cycles: Bounded by seed conservation and monotonic seed removal to storehouses; [gap-fill] if an infinite non-capturing sowing cycle occurs, remaining seeds are swept to pit owners.
- Simultaneous claims on the same resource: Not applicable — turns and sowing laps are strictly sequential.
- Player elimination mid-round: If a player loses all seeds during a round, they pass until the game terminates.
- Resource exhaustion: Total seed count is conserved at 56; capture is the explicit end condition.
- Termination guarantee: Captures permanently reduce board seeds, guaranteeing finite termination.
## State representation
- Persistent state:
- `pits` (14-element array of integers `P[0..13]`).
- `stores` (2-element array `[Store_0, Store_1]`).
- `active_player` (0 or 1).
- `pass_count` (integer tracking consecutive passes).
- Per-turn ephemeral state:
- `hand_seeds` (integer count during multi-lap sowing).
- `current_pit_index` (integer `0..13`).
- `captured_seeds_this_turn` (integer).
- Observable information: Fully observable — all pit contents, storehouse counts, and sowing sequences are public.
## Action space
- `sow_pit(pit_index)`:
- Select pit `pit_index` to lift and sow. Precondition: `pit_index in {0..6}` if Player 0, `pit_index in {7..13}` if Player 1, and `P[pit_index] > 0`.
- `pass_turn()`:
- Precondition: All 7 pits on player's side have `P[i] == 0`.
## Playability notes
- Single-player-vs-AI: Engine-ready perfect-information deterministic game. Excellent for Minimax with Alpha-Beta pruning, evaluation heuristics (seed counting, pit vulnerability), or MCTS.
- Group games (n>4): Strictly a 2-player board game.
- Physical-skill games: Purely mathematical discrete Mancala game; zero physical randomness.
- What is lost in the adaptation: The tactile satisfaction of sliding smooth crimson-and-black *olinda* seeds across intricately carved ebony/hardwood boards (*Olinda Poruwa*).
## Implementation hints
Very simple discrete circular array implementation. Core logic is multi-lap loop with boundary wrapping `(i + 1) % 14` and check-ahead capture condition. Branching factor is at most 7 per turn. Milestone 1: implement sowing loop, multi-lap continuation, cascading capture, and terminal board sweep in under 120 lines.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Olinda Keliya (Sri Lanka). (n.d.). Games of Countries. https://gamesofcountries.com/games/lk-sri-lanka/olinda-keliya
@misc{gamesofcountries-lk-sri-lanka-olinda-keliya,
title = {Olinda Keliya (Sri Lanka)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/lk-sri-lanka/olinda-keliya}
}