A simple, interactive, and feature-rich Tic Tac Toe game built using HTML, CSS, and JavaScript. This project provides a fun way to play the classic game with features like score tracking and game reset options.
This game is live and accessible online. Play it here: Tic Tac Toe Game
- Player Turns: Alternate turns between Player X and Player O.
- Winning Patterns: Automatically detects the winner based on predefined patterns and highlights the winning combination.
- Draw Detection: Identifies and announces if the game ends in a draw.
- Score Tracking: Keeps track of Player X's and Player O's win counts using
localStorage
, ensuring scores persist across browser sessions. - Game Controls:
- New Game: Clears the board while retaining scores.
- Reset Game: Clears the board and restarts the game from scratch.
- Clear History: Resets player scores and game history stored in
localStorage
.
- Responsive Design: The game adjusts to different screen sizes seamlessly.
- Winning Animation: Highlights the winning combination with an animated line.
- HTML: Provides the structure for the game interface.
- CSS: Styles the game layout, animations, and visual feedback.
- JavaScript: Implements game logic, player interactions, score management, and
localStorage
for persistent data.
-
Game Play:
- Players alternate turns by clicking on the grid cells. Player O starts first.
- The game checks for a winner after every move. If a winning pattern is detected, the winner is declared, and their score is updated in
localStorage
. - If all cells are filled without a winner, the game declares a draw.
-
Controls:
- New Game: Clears the grid for a new round while keeping the scores intact.
- Reset Game: Resets the game and clears the grid for fresh gameplay.
- Clear History: Deletes all stored scores and resets the player statistics.
-
Winning Patterns: The game detects winning combinations based on predefined patterns for rows, columns, and diagonals.
-
Persistent Scores: Player scores are saved in
localStorage
, allowing scores to persist even if the page is refreshed or reopened.
follow these steps to run the Tic Tac Toe locally:
-
Clone the repository:
git clone https://github.com/shivlalsharma/tic-tac-toe.git cd tic-tac-toe
-
Open the
index.html
file in your browser.Alternatively, you can set up a local server (e.g., using VS Code Live Server) to view the game in your browser.
This project is licensed under the MIT License - see the LICENSE file for details.
Created and deployed by Shivlal Sharma.
- GitHub: Shivlal Sharma's GitHub
- LinkedIn: Shivlal Sharma's LinkedIn