Skip to content

A classic Tic-Tac-Toe game built using Python and Tkinter. Features a simple GUI for two players, perfect for learning GUI development. Contributions welcome!

License

Notifications You must be signed in to change notification settings

Sa3d-Ka/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game with Python and Tkinter

A classic Tic-Tac-Toe game built using Python and the Tkinter library for the graphical user interface. This project is perfect for beginners learning GUI development in Python. The game features a simple and intuitive interface, allowing two players to compete in the timeless game of Tic-Tac-Toe.


Features

  • Two-Player Game: Play against a friend on the same device.
  • Winning Highlight: Winning moves are highlighted in green for a better visual experience.
  • Random Start: The starting player is chosen randomly for fairness.
  • Restart Option: Easily restart the game at any time with the "Restart" button.
  • Simple Interface: Clean and user-friendly design.

How to Play

  1. Start the Game: Run the Python script to launch the game.
  2. Player Turns: Players take turns clicking on the grid to place their symbol (X or O).
  3. Win or Tie: The game ends when a player gets three of their symbols in a row (horizontally, vertically, or diagonally) or when the grid is full (tie).
  4. Restart: Click the "Restart" button to start a new game.

Installation

  1. Clone the Repository:

    git clone https://github.com/Sa3d-Ka/Tic-Tac-Toe.git
    cd Tic-Tac-Toe
  2. Run the Game: Make sure you have Python installed, then run:

    python tic_tac_toe.py

Code Overview

  • Tkinter GUI: The game uses Tkinter for the graphical interface.
  • Game Logic:
    • Players alternate turns by clicking on the grid.
    • The game checks for a winner after each move.
    • Winning moves are highlighted in green.
  • Restart Functionality: The game can be restarted at any time using the "Restart" button.

Screenshots

Game

Game

Win

Win

Tie

Tie


Dependencies

  • Python 3.x
  • Tkinter (comes pre-installed with Python)

Contributing

Contributions are welcome! If you'd like to improve the game, follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeatureName).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeatureName).
  5. Open a pull request.

License

This project is open-source and available under the MIT License.

About

A classic Tic-Tac-Toe game built using Python and Tkinter. Features a simple GUI for two players, perfect for learning GUI development. Contributions welcome!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages