A Python-based Tic-Tac-Toe game where you play against an unbeatable AI ๐ค using the Minimax Algorithm!
โ
Classic 3x3 Tic-Tac-Toe Board ๐ฒ
โ
AI Opponent with Minimax Algorithm ๐ง
โ
User vs AI Gameplay โ You play as 'X', AI plays as 'O' ๐ฎ
โ
Handles Invalid Moves & Input Errors ๐ซ
โ
Automatically Detects Winners & Draws ๐
- User starts by entering row & column numbers (0-2) โ๏ธ
- AI calculates the best move using the Minimax algorithm ๐ข
- Game updates the board and displays results after each turn โก
- Ends when there's a winner or no moves left ๐
- Recursively evaluates all possible game outcomes ๐ค
- AI chooses moves that maximize its chance of winning ๐
- Guaranteed Unbeatable โ AI will always win or force a draw! ๐ช
# AI calculates the best move using Minimax
best_move(board)
# User inputs a move
row, col = map(int, input("Enter row and column (0-2): ").split())
# Game checks for a winner
winner = check_winner(board) X | O | X
-----------
O | X | O
-----------
O | X | X
Result: It's a draw! ๐ค
๐น Add a GUI version with Tkinter or Pygame ๐จ
๐น Support for multiplayer mode (Player vs Player) ๐ฅ
๐น Difficulty levels (Easy, Medium, Hard) โ๏ธ
๐น Clone the repository
๐น Run the Python script
๐น Play against the AI & try to win! ๐
๐จโ๐ป Developed as part of CodSoft Internship โ Task 2 ๐
Feel free to contribute & improve the game! ๐ก