← Back to Portfolio

Artificial Intelligence · CSCI 3202

Mancala AI Agent

A Mancala-playing AI built from scratch in Python (game engine, random baseline, and search agents), benchmarked head-to-head over 100-game tournaments. Minimax with alpha-beta pruning plus a custom heuristic lifts win rate to 99% at depth 5.

Python NumPy Matplotlib
99% win rate at depth 5 with the new heuristic
~3.9× speedup from alpha-beta pruning at identical win rates
10 deepest search depth made feasible by pruning
100 games per tournament for benchmarking each agent

How it's built

The project is structured as four layers, each independently testable:

The interesting part: pruning vs. heuristic

Plain minimax at depth 10 was projected to take roughly two hours per game, clearly not playable. Alpha-beta pruning kept the same move choices but cut node visits by enough to make depth-10 search feasible in seconds, a ~3.9× speedup.

Even with deeper search, win rate against the baseline plateaued around 96%. The last gains didn't come from more depth. They came from teaching the heuristic to value end-of-game stone sweeps, which are decisive late in a game but invisible to a naive score-difference function. That single change pushed win rate to 99% at depth 5.

Key insight

Past a certain depth, marginal wins come from heuristic design, not raw search. Crediting end-of-game sweeps was a tiny code change that delivered the final 3%, bigger than any extra ply of search had.

What I took away