This is a TIC TAC TOE game with AI. It allows you to play against an AI opponent.
This project implements a classic TIC TAC TOE game with an AI opponent. It's built using Python and the Pygame library to provide a graphical user interface.
Throughout the development of this TIC TAC TOE AI project, I gained valuable knowledge and practical experience in artificial intelligence (AI) and machine learning (ML), including:
-
Minimax Algorithm 🤖: I implemented the minimax algorithm to create a strategic AI opponent for TIC TAC TOE, learning about its principles and application in game development.
-
AI Evaluation and Decision-Making 🧾: I developed skills in evaluating game states and making optimal AI decisions using the minimax algorithm, enhancing my understanding of AI decision trees and game theory.
-
Game Development with Pygame 🎮: I leveraged the Pygame library to create a graphical user interface, gaining experience in game development, user interaction, and rendering game elements.
-
Python Programming and Data Structures 🐍: I honed my Python programming skills, including working with data structures, loops, and conditionals in the context of game development.
-
Game Development Principles 🎯: I developed a deeper understanding of game development principles, including game states, user interaction, and game logic.
Before you begin, ensure you have met the following requirements:
-
Python: Make sure you have Python 3 installed on your system. If not, you can download and install Python from here.
-
Pygame Library: You'll need the Pygame library. You can install it using pip:
pip install pygame
- Clone the Repository:
git clone https://github.com/musaddique333/Tic-Tac-Toe-AI.git
- Choose between Player versus Player (PvP) and Player versus AI (PvAI) modes.
- The AI opponent offers different levels of difficulty.
- The game is built using Pygame, providing a visual and interactive user interface.
- In PvAI mode, you can choose between various AI difficulty levels:
- Random AI: The AI makes random moves.
- Intelligent AI: The AI uses a minimax algorithm to play strategically.
- In PvP mode, you can play against a friend on the same device.
- Use the
g
key to toggle between PvAI and PvP modes. - In PvAI mode:
- Press
0
to switch to the Random AI. - Press
1
to switch to the Intelligent AI.
- Press
- To reset the game, press
r
.