This project implements a Tic-Tac-Toe game with an AI opponent using the minimax algorithm. The AI opponent is designed to play optimally and never lose.
Minimax Algorithm: The AI uses the minimax algorithm to choose the best possible move. User-Friendly Interface: Simple command-line interface for playing the game. Two Player Mode: Option to play against another human player.
Python 3.x Terminal or Command Prompt
Clone the repository:
git clone https://github.com/row-huh/ticTacToeAI.git
Navigate to the project directory:
cd tic-tac-toe-ai
Run the game:
python tic_tac_toe.py
Make sure you have pygame installed!
The game board is a 3x3 grid. Players take turns placing their marker ('X' or 'O') on an empty spot. The first player to get three of their markers in a row (horizontally, vertically, or diagonally) wins. If the board is full and no player has three in a row, the game is a draw. AI Algorithm: Minimax The minimax algorithm is a decision rule used for two-player games. In this project, the algorithm is used to determine the best move for the AI by evaluating all possible future moves and choosing the one that maximizes its chances of winning or minimizing its chances of losing
You can choose to play as an X or O player
The agent plays against you and makes sure that it wins or atleast it doesn't lose!