Chapter 2 · Game

Mangala

← Chapter 2
P1 0 P2 0 Turn P1
Player 2 (Computer)pits 12 ← 7
Player 1 (You)pits 1 → 6

    How to play

    1. Each player has six pits and a store on their own side (Player 1: bottom row and the store on the right; Player 2: top row and the store on the left). Every pit starts with 4 stones.
    2. Click a non-empty pit on your side. All its stones are picked up; the first stone is put back into the same pit and the rest are sown one by one counter-clockwise (a single stone simply moves to the next pit). The opponent's store is skipped.
    3. If the last stone lands in your own store, you get another turn.
    4. If the last stone makes the count in one of the opponent's pits even, you capture the stones in that pit.
    5. If the last stone lands in one of your own empty pits and the pit opposite has stones, you capture the stones of both pits.
    6. The game ends when one side runs out of stones; the player who emptied their side first also takes all the stones left on the opponent's side. The player with more stones in their store wins.

    The blue ring marks the pit where the last move started and the pit where its last stone landed.

    Computer levels

    • Easy: a random legal pit.
    • Medium: greedy; picks the move with the largest immediate gain (an extra turn counts as a bonus).
    • Hard: minimax with alpha-beta pruning, six plies deep (after an extra turn the same player moves again).

    Planning a move

    Before choosing a pit, count where the last stone will land. The last stone matters most: it can win an extra turn, capture stones, or leave stones exposed to the opponent.

    Strategy tips

    • An extra turn can be worth more than a small capture because it keeps the initiative.
    • Watch the opponent's pits for positions that would let them capture many stones.
    • If the endgame does not favor you, do not empty your own side too quickly.

    Link to game theory

    Mangala is a sequential, deterministic game of perfect information. It highlights backward planning, tempo, position evaluation, and the difference between immediate gain and long-term value, making it a natural setting for minimax and alpha-beta search.