A feature-rich Tic-Tac-Toe game built with Python using Tkinter GUI, featuring both single-player (vs AI) and multiplayer modes, scoreboard tracking, and data analysis with visualizations.
- Single Player Mode: Play against an intelligent AI opponent using minimax algorithm
- Multiplayer Mode: Two players can play against each other
- Scoreboard: Track and view game history and outcomes
- Data Analysis: Visualize win percentages with pie charts using matplotlib
- GUI Interface: Clean and intuitive graphical user interface using Tkinter
- Python 3.x
- tkinter (usually comes with Python)
- pandas
- matplotlib
- csv (built-in module)
-
Clone or download this repository
-
Make sure you have Python 3.x installed
-
Install required dependencies:
pip install pandas matplotlib
-
Run the game:
python TicTacToe.py
- Launch the Game: Run
TicTacToe.py
to open the main menu - Choose Game Mode:
- Single Player: Play against the computer AI
- Multiplayer: Two human players take turns
- Make Moves: Click on empty squares to place your mark (X or O)
- Win Conditions: Get three marks in a row (horizontal, vertical, or diagonal)
- View Results: Check the scoreboard to see game history and analysis
- Player plays as 'X'
- Computer plays as 'O' using an intelligent minimax algorithm
- AI provides challenging gameplay
- Two players alternate turns
- Player 1 uses 'X', Player 2 uses 'O'
- Perfect for local multiplayer gaming
- Automatically tracks all game outcomes
- Stores results in
scoreboard.csv
- Displays complete game history in a scrollable window
- Generates pie charts showing win percentages
- Uses pandas for data processing
- Matplotlib for visualization
- Helps players track their performance over time
Tic-Tac-Toe-Game/
│
├── TicTacToe.py # Main game file
├── README.md # This file
└── scoreboard.csv # Generated automatically to store game results
- TicTacToe: Main menu and game coordinator
- TicTacToeBoard: Game board logic and GUI
- DataAnalyzer: Statistical analysis and visualization
- Scoreboard: Display game history
The single-player mode uses the minimax algorithm to provide intelligent gameplay:
- Evaluates all possible moves
- Chooses the optimal move to maximize winning chances
- Provides challenging but fair gameplay
Feel free to fork this project and submit pull requests for improvements such as:
- Enhanced AI difficulty levels
- Better UI/UX design
- Additional game statistics
- Sound effects
- Online multiplayer support
Created as a Python learning project demonstrating:
- Object-oriented programming
- GUI development with Tkinter
- Data analysis with pandas and matplotlib
- Game algorithm implementation (minimax)
Enjoy playing Tic-Tac-Toe!