Mancala

Public domain classic

Sow the seeds and capture the most stones.

Mancala

At a glance

Rules
Kalah: 6 pits a side, 4 stones in each, a store at each end
Players
You against the computer
Difficulty
Easy, Normal and Hard, each a different strength
Controls
Tap or click one of your pits. Esc pauses. There is no keyboard play
Phone
On screens under 620 pixels wide the board turns upright, with your store at the bottom
Saves
Your best store count, in this browser only
Cost
Free, no account

How this version plays

  • You sow counter-clockwise, one stone per pit, into your own store but never the computer's.
  • Extra turn: if your last stone lands in your store, you go again.
  • Capture: if your last stone lands in an empty pit on your side and the pit opposite holds stones, you take those stones and your own last stone into your store.
  • No capture from an empty opposite pit: if the pit across is empty, nothing is taken. Rule sets differ on this, so it is worth knowing which one you are playing.
  • End: the game stops as soon as either side has no stones. Each player keeps what is left on their own side, the bigger store wins, and equal stores are a draw.
  • Stones move one at a time, so you can follow each sow and see exactly where the last one lands.

How the computer plays

  • It searches ahead with minimax and alpha-beta pruning.
  • Easy judges only the position its own move leaves. Normal looks two more moves ahead. Hard looks seven more.
  • It scores a position by the difference between the two stores first, then by how many pits each side can still play from.
  • There is no randomness: the same position always gets the same reply at the same level.
  • It pauses for about two thirds of a second before each move, so you can see what it chose.

Your first move, and what to watch

Every pit starts with four stones, so the third pit from your left drops its last stone in your store and gives you a second move. After that, count before you sow: a pit whose stone count equals its distance from your store is a free turn waiting to be used, and you can sometimes chain two or three of them.

Your empty pits are capture squares whenever the pit across from them is full. The reverse is the danger: a heap sitting opposite one of the computer's empty pits can be taken in one move, so on Hard expect it to aim for exactly that.

Known limits

  • No undo.
  • No keyboard play: you need a mouse or touch.
  • Changing the difficulty during a game starts a new game.
  • A pit draws at most 18 stones, but the number on the pit is always right.
  • If your browser blocks storage, the game still runs but your best score is not kept.
  • The game pauses itself when you switch tabs.

How it was built and checked

AI tool
Codex
First committed
2026-10-14, in a batch of 10 classic games
Size
One HTML file of about 160 lines, no game libraries
Rounds of changes
1 at build, from the build record. One fix since, on 2026-11-11: Easy and Normal played at the same strength, so Easy now judges only its own move
Checked at build
A syntax check and targeted rule checks. The build report lists browser rendering, touch devices and how hard the computer feels as not verified
Checked since
2026-11-11: a rule test over 3,000 random games (477,050 checks, including that the three levels choose differently), and an automated browser check at desktop size (1280 by 720) and phone size (390 by 844) that started a game, tapped pits, played to the end and started again
Played on a phone
2026-11-11, a full game on a real phone before this page went live

Embed Mancala on your site

Free to embed. Please keep the credit link.

<div style="position:relative;padding-top:75%;max-width:640px"><iframe src="https://aivibecodedgames.com/games/mancala/" title="Mancala (free browser game)" style="position:absolute;inset:0;width:100%;height:100%;border:0" loading="lazy" allow="fullscreen" allowfullscreen></iframe></div>
<p><a href="https://aivibecodedgames.com/play/mancala/">Play Mancala free</a> on AI Vibe Coded Games</p>

How it was vibe coded

ToolCodex
Rounds of changes: 1
First committed2026-10-14

The opening prompt

Make Kalah-style Mancala with 6 pits per side and 4 stones each, you versus the computer. Rules: sow counter-clockwise, extra turn if the last stone lands in your store, capture when the last stone lands in an empty pit on your side opposite a non-empty pit, game ends when one side is empty and the other keeps its remaining stones. Animate stones moving one at a time. Easy and Hard computer (minimax depth 3 and 8).

What we learned

  • The prompt named two levels, Easy and Hard. The build added a third, Normal, with the same strength as Easy. A prompt that lists the exact options, or a test that compares them, would have caught it.

Game controls

  • Tap or click one of your pits to sow its stones

The game brief includes touch controls for phones.

Open the game on its own

More games