Skip to content

The Java code implements a simple Tic-Tac-Toe game using Swing for the GUI. Tic-Tc-Toe is a Java-based project designed to help users play tic tac toe game through an intuitive Graphical User Interface (GUI).

Notifications You must be signed in to change notification settings

Amandeepkaur1804/Tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Tictactoe

The Java code implements a simple Tic-Tac-Toe game using Swing for the GUI. Tic-Tc-Toe is a Java-based project designed to help users play tic tac toe game through an intuitive Graphical User Interface (GUI). The game is played on a 3x3 grid. Players take turns clicking buttons to place their respective marks (X or O).

Features

  1. Graphical User Interface (GUI) Utilizes Java Swing (JFrame, JPanel, JButton, JLabel) for interactive elements. Provides a visually appealing 3x3 grid for gameplay.

  2. Turn-based Gameplay: Alternates turn between Player X and Player O. Displays whose turn it is (X or O) using a JLabel at the top.

  3. Interactive Buttons: Clicking on a button places the current player's mark (X or O). Buttons change color and text based on the player's turn.

  4. Win Condition Detection: Checks after each move for win conditions: Three marks in a row (horizontal, vertical, diagonal). Declares the winner and disables further button clicks upon winning.

  5. Tie Detection: Checks if all buttons are filled without a winner. Declares a tie game and disables further button clicks.

  6. Initialization: Randomly determines which player starts first (X or O) using Random class.

  7. Outcome Display: Updates a JLabel with messages indicating the game's current status: "X Turn" or "O Turn" for player turns. "X wins", "O wins", or "Tie" for game outcomes.

Getting Started

Follow these steps to set up and run the Tic-Tac-Toe project:

  1. Clone the Repository: Clone the GitHub repository to your local machine using the following command: sh Copy code git clone https://github.com/Amandeepkaur1804/Tictactoe.git
  2. Open the Project: Use an Integrated Development Environment (IDE) that supports Java to open the project.
  3. Run the Application: Locate the main Java file (TicTacToe.java) and run the application. This will launch the Tic-Tac-Toe GUI.

Contribution

I want you to know that contributions to this project are welcome and encouraged. To contribute:

  1. Fork the repository on GitHub.
  2. Create a new branch with a descriptive name for your feature or bug fix.
  3. Make your changes and improvements to the code.
  4. Test your changes thoroughly.
  5. Create a pull request to merge your changes into the main repository.

Happy playing!

Initialization of game Screenshot (60)

Gameplay while in progress Screenshot (61)

Result display Screenshot (62)

About

The Java code implements a simple Tic-Tac-Toe game using Swing for the GUI. Tic-Tc-Toe is a Java-based project designed to help users play tic tac toe game through an intuitive Graphical User Interface (GUI).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages