Skip to the content.

← Back to Home

Connect Four AI: Minimax with Alpha-Beta Pruning

View Code on GitHub


Overview

This project implements an intelligent AI agent that plays Connect Four using the Minimax algorithm enhanced with Alpha-Beta Pruning. The AI evaluates the board state and makes optimal moves to maximize its chance of winning while minimizing the human player’s chances.

Features

How It Works

The AI agent simulates future moves using a recursive minimax approach:

Example Tests:

Test # Human Moves (Columns) AI Move to Win Winning Combo
0 4, 3, 4, 2 4 Positive diagonal (cols 1–4)
1 6, 1 2 Negative diagonal (cols 1–4)
2 4, 4, 1, 0 4 Positive diagonal (cols 1–4)
3 5, 6 2 Negative diagonal (cols 3–6)

Technologies


← Back to Home