This repository contains a Python-based implementation of the classic game Connect-4, featuring a custom-built Artificial Intelligence opponent. The AI is powered by the Minimax algorithm, allowing it to evaluate complex mid-game board states and calculate the optimal next move by anticipating future turns.
- π§ Intelligent AI Opponent: Plays strategically against the user or evaluates specific board states to find the best possible move.
- βοΈ Minimax Algorithm: Implements a robust decision rule used for minimizing the possible loss for a worst-case scenario.
- π― Depth-Aware Scoring Heuristic: The AI doesn't just look for a win; it optimizes for efficiency.
- β‘ Quick Wins: The scoring function uses a
10 - depthcalculation to prioritize winning the game in the fewest moves possible. - π‘οΈ Delayed Losses: If a loss is inevitable, the AI uses a
depth - 10calculation to prolong the game and force the opponent to work for the win.
- β‘ Quick Wins: The scoring function uses a
- π Board State Evaluation: Capable of loading specific mid-game configurations to predict scores and determine the exact optimal column for the next piece (e.g., predicting a score of 7 and identifying Column 3 as the best move).
- Language: Python π
- Python 3.x installed on your local machine.
- Clone the repository:
git clone [https://github.com/OMZaky/Connect-4.git](https://github.com/OMZaky/Connect-4.git)