Skip to content

aanish27/tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

tictactoe

Tic-Tac-Toe Game Instructions:

Objective: The objective of Tic-Tac-Toe is to be the first player to form a horizontal, vertical, or diagonal line with your symbol (X or O) on the 3x3 game board.

Game Setup:

  1. The game is played on a 3x3 grid, and two players are required—one player will be X, and the other will be O.

Game Rules:

  1. Players take turns to make their moves.
  2. X goes first, followed by O, and the players alternate turns until the game is over.
  3. Each player can place their symbol (X or O) in an empty cell on the grid during their turn.
  4. Once a cell is occupied by a player, it cannot be changed or overwritten.
  5. The game continues until one of the following conditions is met: a. One player gets three of their symbols in a row (horizontally, vertically, or diagonally), making them the winner. b. All cells on the board are occupied, and there is no winner, resulting in a draw.

How to Play:

  1. The 3x3 grid is numbered from 1 to 9, representing the positions where you can place your symbol.

  2. To make a move, follow these steps: a. On your turn, enter the number of the cell where you want to place your symbol (X or O). b. Ensure the number you choose corresponds to an empty cell (one that has not been occupied by a previous move). c. The game will show the updated board after each move.

  3. The game will continue alternating between players until one player wins or the game ends in a draw.

Determining the Winner: The game will automatically check for a winning pattern after each move. If a player places three of their symbols (X or O) in a row, they are declared the winner. The winning patterns are as follows:

  • Three in a row horizontally (e.g., 1-2-3, 4-5-6, 7-8-9).
  • Three in a row vertically (e.g., 1-4-7, 2-5-8, 3-6-9).
  • Three in a row diagonally (e.g., 1-5-9, 3-5-7).

Ending the Game:

  1. If a player wins, the game will display a message announcing the winner and end the game.
  2. If all cells on the board are filled, and there is no winner, the game will announce a draw.

Restarting the Game: After the game ends (either due to a win or a draw), you can choose to play again by running the game one more time.

Enjoy the Game! Have fun playing Tic-Tac-Toe with your opponent and try to outsmart them to become the ultimate winner! Good luck!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages