Skip to content

A simple Tic-Tac-Toe game built in Java using Swing for the GUI. Two players take turns marking X or O on a 3x3 grid, aiming to get three in a row horizontally, vertically, or diagonally. The game declares a winner or a tie if all squares are filled without a winner. The interface is clean, intuitive, and easy to use.

License

Notifications You must be signed in to change notification settings

Aastha-Bhatia/Tic-Tac-Toe-Game

Repository files navigation

Tic-Tac-Toe

This project is a simple yet fully functional Tic-Tac-Toe game built using Java and Swing for the graphical user interface (GUI). The game is designed for two players, taking turns to mark their respective symbols (X or O) on a 3x3 grid. The objective is to be the first player to get three of their marks in a horizontal, vertical, or diagonal row. In the case where all nine squares are filled without a winner, the game ends in a tie.

Screenshots

Here are some screenshots of the game:

Game Screenshot 1 Game Screenshot 2 Game Screenshot 1 Game Screenshot 2

Features

  • User-Friendly Interface: A clean and intuitive GUI using Java Swing for an engaging gameplay experience.
  • Two-Player Mode: Players take turns to mark 'X' or 'O' on the board.
  • Dynamic Gameplay: Automatically switches turns between players and updates the game status.
  • Winning Conditions: The game checks for winning combinations horizontally, vertically, and diagonally.
  • Tie Detection: Declares a tie when all nine squares are filled without a winner.

Installation

  1. Clone this repository:
    git clone https://github.com/Aastha-Bhatia/Tic-Tac-Toe-Game.git
    
  2. Navigate to the project directory:
    cd Tic-Tac-Toe-Game/TicTacToe/TicTacToe/src
    
  3. Compile the Java files:
    javac App.java
  4. Run the application:
    java App

Usage

  • Start the Game: Launch the application to open the Tic-Tac-Toe board.
  • Gameplay: Players take turns clicking on empty tiles to place their marks (X or O).
  • Winning the Game: The game will highlight the winning combination and display the winner.
  • Game Over: If the board is full without a winner, the game declares a tie.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

  • Java & Swing: For providing the framework to build the game's GUI.
  • Inspiration: Classic Tic-Tac-Toe games.

Created By

Aastha Bhatia

Special Thanks

Thanks to Kenny YiP Coding for the tutorials that helped me learn and build this game.

Connect

Connect with me on LinkedIn.

Feel free to contribute, provide feedback, or ask any questions! Enjoy playing the game!

About

A simple Tic-Tac-Toe game built in Java using Swing for the GUI. Two players take turns marking X or O on a 3x3 grid, aiming to get three in a row horizontally, vertically, or diagonally. The game declares a winner or a tie if all squares are filled without a winner. The interface is clean, intuitive, and easy to use.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages