Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Tic-Tac-Toe Game

This is a simple implementation of a Tic-Tac-Toe game in Java using Swing. The game allows two players to take turns, with one player as 'X' and the other as 'O'. There is also a computer player to play as 'O' against the human player.

Table of Contents

Overview

This program provides a graphical interface for playing the classic Tic-Tac-Toe game against another player or against a computer AI. The game has a 3x3 grid, and the first player to form a line of their symbols ('X' or 'O') horizontally, vertically, or diagonally wins the game.

Features

  • Play against another player or a computer AI.
  • Beautiful graphical user interface.
  • Simple and intuitive gameplay.
  • Game status displayed at the top.
  • Option to restart the game at any time.

How to Play

  1. Clone or download this repository to your local machine.
  2. Compile and run the TicTacToeGame class.
  3. The game window will open, and you can start playing.

Installation

  1. Ensure you have Java installed on your system.
  2. Clone or download this repository to your local machine.

Usage

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you downloaded the code.
  3. Compile the code using javac TicTacToeGame.java.
  4. Run the game with java TicTacToeGame.

Game Rules

  • The game is played on a 3x3 grid.
  • Players take turns to place their symbol ('X' or 'O') in an empty cell by clicking the corresponding cell.
  • The game continues until one player wins or the grid is full.
  • A player wins by forming a horizontal, vertical, or diagonal line of their symbols.
  • If the grid is full and no player has won, the game ends in a draw.
  • You can restart the game at any time by clicking the "Restart" button.

Contributing

Contributions to this project are welcome. If you have suggestions, bug reports, or feature requests, please open an issue or create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.