Skip to content

An Unbeatable AI based on Game theory to play with in TIC TAC TOE

Notifications You must be signed in to change notification settings

musaddique333/Tic-Tac-Toe-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TIC TAC TOE AI

GitHub GitHub stars GitHub forks GitHub issues Python Pygame

This is a TIC TAC TOE game with AI. It allows you to play against an AI opponent.

Image 1 Image 2 Image 3

About the Project

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.

What I Learned 🧠

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Game Development Principles 🎯: I developed a deeper understanding of game development principles, including game states, user interaction, and game logic.

Requirements 📦

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

Getting Started 🚀

Clone the Repository

  1. Clone the Repository:
    git clone https://github.com/musaddique333/Tic-Tac-Toe-AI.git
    

Features

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

Gameplay

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

How to Play

  1. Use the g key to toggle between PvAI and PvP modes.
  2. In PvAI mode:
    • Press 0 to switch to the Random AI.
    • Press 1 to switch to the Intelligent AI.
  3. To reset the game, press r.

Author 👨‍💻

  • Author: musaddique333 GitHub

About

An Unbeatable AI based on Game theory to play with in TIC TAC TOE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages