V.Vidhya Logo

V.Vidhya

TicTacToe Game


Develop a simple text-based Tic-Tac-Toe game where two players take turns placing X and O on a 3x3 board. The game should determine the winner or declare a draw.

Instructions
  • The game is played on a 3x3 grid.
  • Two players take turns marking a square (Player 1: X, Player 2: O).
  • A player wins if they get three of their marks in a row (horizontally, vertically, or diagonally).
  • If the board fills up without a winner, the game ends in a draw.
  • The system should:
    • Display the board before each move.
    • Prompt the current player to enter a move (1-9).
    • Validate the move (ensure the chosen cell is empty).
    • Check for a winner or a draw after every move.


Feel free to implement additional features to enhance the gameplay.


Prev Post
Calendar
Next Post
Hangman Game