Skip to content

BigB021/Tic-Tac-Toe-AI-with-Minimax-and-Alpha-Beta-Pruning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe AI with Minimax and Alpha-Beta Pruning

Description

This project implements a classic Tic-Tac-Toe game where a player can play against an AI. The AI uses the Minimax algorithm with Alpha-Beta pruning to make decisions, making it a challenging opponent. The game is built using Python, with a simple graphical user interface (GUI) created with Tkinter.

Features

  • Play against a smart AI that calculates its moves using Minimax and Alpha-Beta pruning.
  • Simple and intuitive GUI.
  • Automatic detection of win, lose, or draw states.

Installation

Requirements

  1. Python 3.x
  2. Tkinter (usually comes with Python) Setup
  3. Clone this repository to your local machine.

git clone https://your-repository-link-here 2. Navigate to the cloned directory.

cd tic-tac-toe-minimax-alpha-beta

Usage

To start the game, simply run the Python script from your terminal or command prompt.

python tic_tac_toe.py Once the game window opens:

You will play as 'O', and the AI will play as 'X'. Click on any of the 9 squares to make your move. The AI will automatically make its move after you. The game ends when one player wins or there's a draw. A message box will appear announcing the winner or if it's a draw.

How It Works

The AI's decision-making process uses the Minimax algorithm enhanced with Alpha-Beta pruning to evaluate the game state and determine the best possible move. This algorithm considers all possible moves, their implications, and the opponent's potential responses to select the optimal move.

Contributing

Feel free to fork this repository and submit pull requests to contribute to this project. You can also open issues for bugs you've found or features you think should be added.

License

This project is open-sourced under the MIT License.

Author

Youssef Aitbouddroub

Acknowledgments

This project was inspired by the desire to create a challenging Tic-Tac-Toe AI.

About

A classic Tic-Tac-Toe game where a player can play against an AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages