Skip to content

This repo contains a Java-based Tic Tac Toe game featuring a graphical user interface (GUI) for two players.

License

Notifications You must be signed in to change notification settings

MishkatIT/tic-tac-toe-using-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Game

Overview

This Java-based Tic Tac Toe game provides a graphical user interface (GUI) for two players to engage in the classic Tic Tac Toe experience. Players take turns marking the cells of a 3x3 grid, aiming to achieve three in a row either horizontally, vertically, or diagonally.

How to Play

  1. Run the Game:

    • Compile the Java files using a Java compiler:
      javac tic_tac_toe/*.java
    • Run the main class:
      java tic_tac_toe.Main
  2. Enter Player Names:

    • Upon launching the game, players are prompted to enter their names.
    • The names are obtained through input dialogs, ensuring non-empty entries.
  3. Gameplay:

    • Players click on the grid cells to make their moves.
    • The game alternates turns between Player 1 (X) and Player 2 (O).
  4. Winning and Draw:

    • The game declares a winner when a player achieves three in a row.
    • If all cells are filled without a winner, the game recognizes a draw.
  5. Play Again:

    • After each game, players are prompted to play again or exit the application.

Features

  • Graphical User Interface (GUI):
    • The game employs Java Swing for a user-friendly and visually appealing interface.
  • Dynamic Turn Indicator:
    • A status label at the bottom dynamically indicates whose turn it is (X or O).
  • Winner Declaration:
    • The game declares the winner and prompts for a new game or exit.
  • Draw Handling:
    • A draw is recognized when all cells are filled without a winner.

How to Contribute

Contributions to enhance features, fix issues, or optimize code are welcome. Fork the repository, make your changes, and submit a pull request.

Contributors

  • [Mishkatul_Islam]

Enjoy playing Tic Tac Toe!