A feature-rich Connect Four game developed in Python with Pygame, featuring multiple game modes, an AI opponent powered by the Minimax algorithm, player management, MySQL database integration, and an interactive statistics dashboard.
- 🎮 Player vs Player mode
- 🤖 Player vs AI mode
- 🧠 AI with Minimax algorithm
- 📊 Three AI difficulty levels
- 👤 Player profile management
- 💾 MySQL database integration
- 📝 Match history
- 📈 Statistics dashboard with charts
- 🏆 Player ranking system
- 🎨 Interactive graphical interface
- Python
- Pygame
- PyMySQL
- MySQL
- Matplotlib
ConnectFour/
├── main.py
├── player.py
├── enemy.py
├── database.py
├── settings.py
The AI opponent is based on the Minimax algorithm with multiple difficulty levels:
- Beginner: Random valid moves
- Intermediate: Minimax with limited depth
- Advanced: Optimized Minimax with board evaluation
The application stores:
- Player profiles
- Match history
- Game duration
- Difficulty level
- Results (Win / Loss / Draw)
- Player statistics
-
Clone the repository.
-
Install the required dependencies:
pip install pygame pymysql matplotlib
-
Configure your MySQL database.
-
Run the application:
python main.py
This project demonstrates:
- Game development with Pygame
- Artificial Intelligence (Minimax)
- MySQL database integration
- Data visualization with Matplotlib
- Modular Python programming
- Exception handling
- Matrix-based game logic
Developed by Amirouch Issam as an academic project using Python and modern software development practices.