Ayo (or Ayò Ọlọ́pọ́n) is a traditional two-player board game of the Yoruba people of South Western Nigeria. Known as the "Game of the Intellectual", it is a mathematical mancala variant played on a 2×6 grid board containing 48 seeds (4 seeds per pit at initialisation).
# Ayò Ọlọ́pọ́n — Online Board Game
Ayò Ọlọ́pọ́n is a traditional mathematical mancala board game of the Yoruba people of South Western Nigeria. Known as the "Game of the Intellectual," it is a finite, deterministic game of perfect information. It is modeled mathematically as a circular zero-sum combinatorial system where seed redistribution operates under circular modular arithmetic.
This project implements a web-based version of Ayo with a stateless FastAPI backend rules engine, an adversarial minimax CPU agent, and an interactive, responsive HTML5/CSS3/JavaScript frontend.
---
## 🎮 Game Rules & Mechanics
### 1. Board Representation
* **The Grid:** A 2×6 layout of 12 pits.
* **South (Player 0):** Pits `0` to `5` (left-to-right along the bottom).
* **North (Player 1):** Pits `6` to `11` (reversed right-to-left along the top).
* **Sowing Direction:** Counter-clockwise: `0 → 1 → ... → 5 → 11 → 10 → ... → 6 → 0`.
* **Initial State:** 4 seeds per pit (48 total active seeds). Scores begin at `0 - 0`.
### 2. Circular Modulo Sowing
* Redistribution lifts all seeds from a chosen pit and drops them one-by-one counter-clockwise.
* **Starting Pit Skip Rule:** If a sowing contains $\ge 12$ seeds (looping back to the origin), the starting pit is skipped during redistribution, requiring modulo-11 arithmetic. The origin remains empty at the end of sowing.
### 3. Capture Rules
* **Landing Condition:** A capture triggers only when the final seed lands in an opponent's pit and makes exactly **4 seeds** (house win).
* **Chain Captures:** Sowing then checks backwards (against sowing direction) in adjacent opponent pits. Any consecutive preceding pits containing exactly 4 seeds are also captured. The chain stops at the first pit that is not an opponent's pit or does not contain exactly 4 seeds.
* **Grand-Slam Annulment:** If a capture would leave the opponent with zero seeds on their side, the entire capture is annulled (no seeds scored, seeds stay in place), …