https://github.com/f1scher7/tic_tac_toe-ai
This is a Python implementation of Tic Tac Toe game with an AI opponent. The game allows players to play against each other or against an AI with different levels of difficulty.
https://github.com/f1scher7/tic_tac_toe-ai
pygame-games python3
Last synced: 3 months ago
JSON representation
This is a Python implementation of Tic Tac Toe game with an AI opponent. The game allows players to play against each other or against an AI with different levels of difficulty.
- Host: GitHub
- URL: https://github.com/f1scher7/tic_tac_toe-ai
- Owner: f1scher7
- Created: 2023-07-02T17:46:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T17:39:07.000Z (about 1 year ago)
- Last Synced: 2025-01-08T09:15:27.489Z (5 months ago)
- Topics: pygame-games, python3
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tic Tac Toe AI
This is a Python implementation of Tic Tac Toe game with an AI opponent. The game allows players to play against each other or against an AI with different levels of difficulty.
## Features
- **Player vs Player Mode:** Players can play against each other on the same device.
- **Player vs AI Mode:** Players can play against an AI opponent.
- **AI Difficulty Levels:** The AI opponent has different difficulty levels:
- Level 0: Random moves.
- Level 1: AI uses the minimax algorithm to make intelligent moves.
- **Visual Feedback:** Visual indication of the game progress, including marking winning lines and indicating whose turn it is.
- **Interactive Interface:** Players can interact with the game using mouse clicks or keyboard inputs.
## How to Play- **Player vs Player Mode:**
- Two players take turns clicking on the empty squares to mark their moves.
- The game ends when one player wins or there is a tie.
- **Player vs AI Mode:**
- The player makes moves by clicking on the empty squares.
- If playing against the AI, choose the AI difficulty level by pressing keys:
- Press `0` for random AI.
- Press `1` for AI using the minimax algorithm.
- The AI makes its move after the player's move.
- The game ends when either the player or the AI wins, or there is a tie.
- **Game Controls:**
- Press `g` to switch between Player vs Player and Player vs AI modes.
- Press `r` to reset the game board.## Example operation

## Author
- Maks Szyło - [email protected].
## License
This project is licensed under the [MIT License](LICENSE).