CheckersAI

A Python game-playing agent using depth-limited search and heuristic evaluation.

Concept illustration of checkers lookahead and pruned search branches
Concept illustration of lookahead and pruning in a checkers agent.

Give an agent a reason to choose a move

From September to December 2022, I worked on CheckersAI, a Python course project using depth-limited alpha-beta search and a heuristic board evaluation. My work included the search and scoring logic, debugging move handling, testing against simpler agents, and documenting the approach.

The central problem was choosing among legal moves with limited time to look ahead.


Search, then evaluate the frontier

The agent explores future board states to a configured depth. Alpha-beta pruning lets it skip branches that cannot change the decision under the search’s current bounds.

At the search boundary, the evaluation function estimates the position. I worked with weights for captures, vulnerable pieces, protected positions, and kings, then adjusted them while observing the agent’s behavior against baseline opponents.

Those weights encode preferences rather than certainty. A locally appealing capture can lead to a poor position several turns later, and increasing the search depth changes what the heuristic needs to account for.


State restoration matters

Board and move structures represent pieces, positions, slides, and multi-step captures. A move history supports restoring earlier board states, which is necessary when the search explores one branch and then returns to try another.

I investigated errors around board helper methods and king state. These were useful debugging exercises because an incorrect state can produce a plausible-looking move while contaminating the rest of the search.


What the experiments showed me

Running the agent against simpler strategies helped me inspect the heuristic, expose weaknesses, and compare the effects of scoring changes.

The main lesson was the dependency between rules, representation, and strategy. A better scoring function cannot compensate for a move generator or undo operation that leaves the board wrong. This project strengthened my habit of checking the foundations before tuning the behavior built on top of them.