Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect Four AI

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.

Features

  • 🎮 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

Technologies

  • Python
  • Pygame
  • PyMySQL
  • MySQL
  • Matplotlib

Project Structure

ConnectFour/
├── main.py
├── player.py
├── enemy.py
├── database.py
├── settings.py

AI

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

Database

The application stores:

  • Player profiles
  • Match history
  • Game duration
  • Difficulty level
  • Results (Win / Loss / Draw)
  • Player statistics

Installation

  1. Clone the repository.

  2. Install the required dependencies:

    pip install pygame pymysql matplotlib
  3. Configure your MySQL database.

  4. Run the application:

    python main.py

Learning Objectives

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

Authors

Developed by Amirouch Issam as an academic project using Python and modern software development practices.

About

A Python Connect Four game built with **Pygame**, featuring PvP and AI modes powered by the **Minimax** algorithm. Uses **PyMySQL** for MySQL database integration to manage players, game history, and statistics, while **Matplotlib** provides interactive charts and performance analytics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages