Skip to content

Allowing Two Players to Compete in Real-time, with Automatic Detection of Game Outcomes (win, lose, draw).

Notifications You must be signed in to change notification settings

deepak-pandey1/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Screenshot 2024-10-08 034402

Tic Tac Toe Game

This project is a simple and interactive Tic Tac Toe Game built using HTML, CSS, and JavaScript. The game allows two players to take turns marking the spaces in a 3x3 grid. The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins the game.

Features

  • Two-Player Mode: Players take turns to place their marks (X or O) on the grid.
  • Winning Logic: The game detects the winner once three marks are aligned, and it highlights the winning line.
  • Draw Condition: If all the spaces are filled and no player wins, the game ends in a draw.
  • Restart Game: Players can restart the game at any time by clicking the restart button.

Technologies Used

  • HTML: For structuring the game board and layout.
  • CSS: For styling the board, marks, and other elements.
  • JavaScript: To implement the game logic and interactivity.

How to Use

  1. Clone the repository to your local machine:
  2. git clone https://github.com/your-username/tic-tac-toe-game.git
  3. Open the index.html file in your web browser to start playing the game.
  4. Click on any empty grid space to place your mark. The game will automatically switch turns between players.
  5. Click the "Restart" button to reset the game and play again.

Project Structure


.
├── index.html        # Main HTML file
├── style.css         # CSS for styling the game board and elements
└── script.js         # JavaScript file for game logic and interactions

Future Enhancements

  • Add an AI opponent for a single-player mode.
  • Implement different difficulty levels for the AI.
  • Include animations for a more dynamic game experience.