Skip to content

Files

Latest commit

df0da37 · Jan 20, 2025

History

History
24 lines (19 loc) · 987 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 987 Bytes

Java Tic Tac Toe Game

A simple Tic Tac Toe game implemented in Java with a GUI. This game allows two players (Player X and Player O) to take turns and play on a 3x3 grid. The current player's turn is displayed, and the grid updates with an image for each player's move.

Features

  • Two-player mode (Player X and Player O).
  • A graphical user interface (GUI) with a 3x3 grid of buttons.
  • Displays current player's turn at the top.
  • Game automatically detects win or draw conditions.

How to Play

  1. Run the game.
  2. Player X starts by clicking any empty cell on the 3x3 grid.
  3. Player O then takes their turn by clicking an empty cell.
  4. The game alternates turns between Player X and Player O.
  5. The game ends when one player wins, or if all cells are filled resulting in a draw.

How to Run

  1. Clone the repository or download the files.

  2. Ensure you have Java installed on your machine (JDK 8 or higher).

  3. Compile the Java code:

    javac TicTacToe.java