Skip to content

Latest commit

ย 

History

History
30 lines (24 loc) ยท 1.23 KB

File metadata and controls

30 lines (24 loc) ยท 1.23 KB

๐ŸŽฎ Connect Four with Python, Pygame & AI

image

An interactive version of the classic Connect Four game, built with Python and Pygame, featuring a clean GUI and an intelligent AI opponent using the Minimax algorithm with Alpha-Beta pruning.

๐Ÿง  AI Difficulty Levels:

  • Easy โ€“ Random AI
  • Medium โ€“ Minimax with shallow depth
  • Hard โ€“ Minimax with deeper search and Alpha-Beta pruning image

๐ŸŽฎ Game Modes:

  • Player vs Player
  • Player vs AI

๐Ÿ–ฅ๏ธ Features:

  • Smooth graphical user interface using Pygame
  • Real-time move previews
  • Win and draw detection
  • Reset and replay functionality
  • Object-Oriented clean codebase

๐Ÿค– Minimax + Alpha-Beta Pruning:

The AI uses the Minimax algorithm to evaluate game states and simulate optimal moves. Alpha-Beta pruning is applied to ignore unpromising branches, improving performance significantly at deeper levels. image

๐Ÿš€ How to Run:

pip install pygame
python connect_four.py