Skip to content

A fun and engaging version of the classic Tic Tac Toe game, designed for two players to compete

Notifications You must be signed in to change notification settings

Omid2831/Tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Game 🎮

This is a native Java implementation of the classic Tic Tac Toe game. The game features a graphical user interface (GUI) built using Swing, offering smooth gameplay with automatic win/draw detection.


🖼️ Demo

Gameplay Example:

Gameplay Screenshot

Click the image above to watch the gameplay video.

✨ Features

  • Two-player gameplay: Play with friends using classic Tic Tac Toe rules.
  • GUI built with Swing: Intuitive interface for quick interactions.
  • Dynamic game logic: The game checks for winners and draws automatically.

🚀 How to Run

Prerequisites

Clone the Repository

  1. Open your terminal and clone the repository:
git clone https://github.com/Omid2831/Tic-tac-toe.git
  1. Navigate into the project directory:
cd Tic-tac-toe

Compile and Run

  1. Compile the source files and place the compiled classes in the bin directory:
javac -d bin *.java
  1. Run the program:
java -cp bin main

(Please make sure main.java is your program's entry point.)

🛠️ File Structure

📂 Tic-tac-toe
 ├── main.java            # Main entry point of the application
 ├── TikTakToe.java       # Game logic and GUI implementation
 ├── main.class           # Compiled bytecode for main
 ├── TikTakToe.class      # Compiled bytecode for game logic
 ├── 📂 capture
 │    ├── Demo.mp4      # Gameplay video
 │    └── pic.png         # Screenshot of the game
    

🧑‍💻 How It Works

The game operates as follows:

  1. Game Setup

    • The game is played on a 3x3 grid.
    • Two players take turns to mark their respective symbols (X or O).
  2. Gameplay

    • The GUI dynamically updates to reflect each player's move.
    • Players alternate turns until a win, draw, or loss condition is met.
  3. Game Result Detection

    • The program checks for the following outcomes:
      • Wins:
        • Three aligned marks (horizontally, vertically, or diagonally).
      • Loss:
        • The other player achieves three aligned marks.
      • Draws:
        • The board is full, and no player has achieved three aligned marks.
  4. Feedback

    • The GUI highlights:
      • Winning cells if a player wins.
      • A message indicates the game result (win, loss, or draw).

About

A fun and engaging version of the classic Tic Tac Toe game, designed for two players to compete

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages