|
| 1 | +# Tic-Tac-Toe Game with AI |
| 2 | + |
| 3 | +This project is a Tic-Tac-Toe game implemented in Python using the Pygame library. The game presents a classic, engaging experience where players can compete against either an AI opponent or another human player. The AI leverages the Minimax algorithm, a decision-making algorithm used in game theory, to evaluate potential moves and choose the best possible action at each turn. This guarantees that the AI will always make optimal moves, creating a challenging and competitive environment for players of all skill levels. |
| 4 | + |
| 5 | +### Key Features: |
| 6 | +- **Two Players**: Play against an AI or another human player. |
| 7 | +- **Minimax Algorithm**: The AI makes optimal moves based on the Minimax strategy. |
| 8 | +- **Graphical User Interface**: A simple and intuitive GUI using Pygame. |
| 9 | +- **Reset Option**: Restart the game easily at any time. |
| 10 | + |
| 11 | +# Prerequisites |
| 12 | +The following libraries are required to run the script: |
| 13 | +```bash |
| 14 | +pip install pygame numpy |
| 15 | +``` |
| 16 | + |
| 17 | +# Installing Instructions |
| 18 | +1. **Clone the Repository**: |
| 19 | + Clone this repository to your local machine using: |
| 20 | + ```bash |
| 21 | + git clone <repository-url> |
| 22 | + ``` |
| 23 | + |
| 24 | +2. **Install Dependencies**: |
| 25 | + Navigate to the project directory and install the required packages: |
| 26 | + ```bash |
| 27 | + pip install pygame numpy |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Run the Script**: |
| 31 | + After cloning and installing dependencies, you can run the script directly: |
| 32 | + ```bash |
| 33 | + python tic_tac_toe.py |
| 34 | + ``` |
| 35 | + |
| 36 | +4. **Customize the Script**: |
| 37 | + You can modify game settings, such as board size and player options, directly in the script. |
| 38 | + |
| 39 | +# Usage |
| 40 | +**Player vs AI**: Click on the grid to make your move. The AI will respond automatically. |
| 41 | + |
| 42 | +**Restart Game**: Press the R key to restart the game at any time. |
| 43 | + |
| 44 | +# Example |
| 45 | +After starting the game, you can play by clicking on the grid cells. The AI will make its move following your turn, and the game will continue until one player wins or the game ends in a draw. |
| 46 | + |
| 47 | +# Author |
| 48 | +**[Naumantamboli](https://github.com/Naumantamboli)** |
0 commit comments