Bao la Kiswahili — the most complex mancala game, with 63 AI and utility modules in Python
# Bao la Kiswahili — The Magnum Opus
**The most complex mancala game in existence, implemented in Python with 60+ AI and utility modules.**
---
## The Kenya Board Game Series
This is the fourth and final entry in a progressive series teaching students
ages 10–17 how to code AI for mancala games:
| Game | Difficulty | Board | Language | Repo |
|------|-----------|-------|----------|------|
| **Shisima** | ★☆☆☆☆ | Triangle, 3 pieces | HTML/JS | shisima-game-lesson |
| **Giuthi** | ★★☆☆☆ | 2×8, relay sowing | HTML/JS | giuthi-ai-explorer |
| **Kiothi** | ★★★☆☆ | 2×10, nki, chain captures | HTML/JS | kiothi-mancala-lesson |
| **Bao la Kiswahili** | ★★★★★ | 4×8, two phases, nyumba, kichwa | **Python** | **This repo** |
## What is Bao la Kiswahili?
Bao la Kiswahili ("board of the Swahili people") is the most sophisticated
mancala game ever devised. Played in Zanzibar and coastal Tanzania, it
features:
- **4×8 board** (32 pits) with 64 seeds
- **Two phases**: *namua* (seed placement from hand) and *mtaji* (sowing
from board)
- **Nyumba** (house): a special pit with 6+ seeds that can be "taxed" or
enter *safari* mode
- **Kichwa** (head): directional sowing rules from board edges
- **Marker pits**: inner-row pits facing non-empty opponent pits
- **Complex captures**: capturing requires crossing from your row to the
opponent's row, with directional constraints
- **Takasia**: restricted pits that cannot be sown from
Bao is considered a thinking game of the highest order — grandmasters in
Zanzibar are held in the same esteem as chess grandmasters elsewhere.
## Project Structure
```
bao-la-kiswahili/
├── bao/
│ ├── config.py # Constants (rows, cols, player positions)
│ ├── board.py # GameState, BaoBoard, Move, MoveResult
│ ├── engine.py # Rule engine: moves, captures, sowing, game over
│ ├── cli.py # Command-line interface
│ ├── ai/ # 34 AI strategy modules
│ │ ├── base.py # BaoAI abstract …