Skip to content

A classic Tic Tac Toe game built in Python using Tkinter. Features both Player vs Player and Player vs Computer modes with basic AI logic that can win or block intelligently. The interface is fully styled, responsive, and built for an engaging game experience.

Notifications You must be signed in to change notification settings

iMD10/tic-tac-toe-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Tic Tac Toe โ€“ Python Tkinter GUI

A classic Tic Tac Toe game built in Python with a user-friendly GUI using Tkinter. Supports two game modes:

  • ๐Ÿ‘ฅ Player vs Player
  • ๐Ÿค– Player vs Computer (AI)

The AI uses intermediate logic to attempt to win or block the player, giving a fun and fair challenge.


๐Ÿ–ผ๏ธ Features

  • โœ… Graphical interface with clean button layout
  • โœ… Player vs Player (PvP) mode
  • โœ… Player vs Computer (PvE) mode
  • โœ… Basic AI with win/block strategy
  • โœ… Tie and win detection
  • โœ… Restart and role selection
  • โœ… Centered window and styled UI

๐Ÿ› ๏ธ How to Run

Requirements

  • Python 3.10 or higher
  • No external packages required (just uses built-in tkinter)

Steps

  1. Clone the repo or download the .py file:

    git clone https://github.com/iMD10/tic-tac-toe-python.git
    cd tic-tac-toe-python
  2. Run the game:

    python TicTacToeUI.py

๐Ÿ“ธ Screenshots

image

image

image


๐Ÿง  AI Logic

The AI follows an intermediate approach:

  • If it can win, it plays the winning move.
  • If the player is about to win, it blocks.
  • Otherwise, it plays the first available move.

๐Ÿ‘จโ€๐Ÿ’ป Author

  • Muhannad Majed
    GitHub: @iMD10

About

A classic Tic Tac Toe game built in Python using Tkinter. Features both Player vs Player and Player vs Computer modes with basic AI logic that can win or block intelligently. The interface is fully styled, responsive, and built for an engaging game experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages