Skip to content

AmulyaJain2004/Tic-Tac-Toe-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game

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.

Features

  • 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

Requirements

  • Python 3.x
  • tkinter (usually comes with Python)
  • pandas
  • matplotlib
  • csv (built-in module)

Installation

  1. Clone or download this repository

  2. Make sure you have Python 3.x installed

  3. Install required dependencies:

    pip install pandas matplotlib
  4. Run the game:

    python TicTacToe.py

How to Play

  1. Launch the Game: Run TicTacToe.py to open the main menu
  2. Choose Game Mode:
    • Single Player: Play against the computer AI
    • Multiplayer: Two human players take turns
  3. Make Moves: Click on empty squares to place your mark (X or O)
  4. Win Conditions: Get three marks in a row (horizontal, vertical, or diagonal)
  5. View Results: Check the scoreboard to see game history and analysis

Game Modes

Single Player Mode

  • Player plays as 'X'
  • Computer plays as 'O' using an intelligent minimax algorithm
  • AI provides challenging gameplay

Multiplayer Mode

  • Two players alternate turns
  • Player 1 uses 'X', Player 2 uses 'O'
  • Perfect for local multiplayer gaming

Features Overview

Scoreboard

  • Automatically tracks all game outcomes
  • Stores results in scoreboard.csv
  • Displays complete game history in a scrollable window

Data Analysis

  • Generates pie charts showing win percentages
  • Uses pandas for data processing
  • Matplotlib for visualization
  • Helps players track their performance over time

File Structure

Tic-Tac-Toe-Game/
│
├── TicTacToe.py      # Main game file
├── README.md         # This file
└── scoreboard.csv    # Generated automatically to store game results

Technical Details

Classes

  • TicTacToe: Main menu and game coordinator
  • TicTacToeBoard: Game board logic and GUI
  • DataAnalyzer: Statistical analysis and visualization
  • Scoreboard: Display game history

AI Algorithm

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

Contributing

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

Author

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages