sherwyn11 / Tic-Tac-Toe-AI

A Tic-Tac-Toe game made in Pygame where the game plays by itself using AI!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tic-Tac-Toe-AI

A Tic-Tac-Toe game made in Pygame where the game plays by itself using AI!

Overview

AI algorithm used: MiniMax algorithm

About the MiniMax algorithm:

  • Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and game theory. It provides an optimal move for the player assuming that opponent is also playing optimally.
  • Mini-Max algorithm uses recursion to search through the game-tree.
  • Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-tac-toe, go, and various tow-players game. This Algorithm computes the minimax decision for the current state.
  • In this algorithm two players play the game, one is called MAX and other is called MIN.
  • Both the players fight it as the opponent player gets the minimum benefit while they get the maximum benefit.
  • Both Players of the game are opponent of each other, where MAX will select the maximized value and MIN will select the minimized value.
  • The minimax algorithm performs a depth-first search algorithm for the exploration of the complete game tree.
  • The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack the tree as the recursion.

Working Demonstration

Getting Started

  1. Clone this repo
git clone <this_repo_url>
  1. Download the required Python packages
cd Tic-Tac-Toe-AI
pip install -r requirements.txt
  1. Run the Python script
python main.py

References

Mini-Max Algorithm in Artificial Intelligence

License

License: MIT

MIT License Link


© 2020 Sherwyn D'souza

About

A Tic-Tac-Toe game made in Pygame where the game plays by itself using AI!

License:MIT License


Languages

Language:Python 100.0%