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.
-
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
- Compile the Java files using a Java compiler:
-
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.
-
Gameplay:
- Players click on the grid cells to make their moves.
- The game alternates turns between Player 1 (X) and Player 2 (O).
-
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.
-
Play Again:
- After each game, players are prompted to play again or exit the application.
- 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.
Contributions to enhance features, fix issues, or optimize code are welcome. Fork the repository, make your changes, and submit a pull request.
- [Mishkatul_Islam]
Enjoy playing Tic Tac Toe!