Connect Four is a classic two-player strategy game:
- Players take turns dropping colored discs (Red/Yellow) into a 6ร7 grid.
- Discs occupy the lowest available slot in a column.
- The goal: Connect four of your discs vertically, horizontally, or diagonally.
- Game ends when the board is full; the player with the most connected-fours wins.
The game supports two advanced AI algorithms:
| Algorithm | Description |
|---|---|
| Minimax | Evaluates all possible moves to an optimal depth. Thorough but slower. |
| Alpha-Beta Pruning | Optimized Minimax that skips irrelevant branches for faster computation. |
AI Features:
- Configurable difficulty levels: Easy โ Expert (depth 2โ8)
- Real-time move evaluation per column
- Interactive decision-making visualization
โ Interactive Game Board:
- 6ร7 grid with real-time piece visualization
- Highlights current playerโs potential move
โ AI Decision Panel:
- Displays algorithm type, search depth, thinking time
- Shows column-by-column move evaluation
- Includes visual bar graph of AI evaluation
โ Game Setup Interface:
- Choose game mode: Human vs Human, Human vs AI, AI vs AI
- Select AI difficulty and algorithm
โ Game Outcome:
- Clear victory announcement
- Highlight winning combination for immediate feedback
โ Educational Value:
- Learn Minimax and Alpha-Beta Pruning in action
- Understand AI decision-making strategies
-
Core Algorithms:
- Minimax (basic AI)
- Alpha-Beta Pruning (optimized AI)
-
Board Evaluation: Heuristic scoring of positions
-
Gameplay Mechanics:
- Valid move checking
- Win condition detection (horizontal, vertical, diagonal)
- Turn management & animations
(Include screenshots of the board, AI panel, and setup menu here)
- Clone the repository:
git clone <your-repo-url>
cd Connect-4-game- Install dependencies:
pip install numpy pygame- Run the game:
python connect_four.py- Add sound effects and animations
- Allow custom board sizes and piece colors
- Implement online multiplayer mode
- Add save/load game state functionality
This project is more than a game:
- Combines strategy, AI, and interactive UI
- Great for learning game AI concepts
- Perfect for portfolio showcase with professional presentation