Tic Tac Toe - Click me to Play!
A simple and classic Tic Tac Toe game built with Vanilla JavaScript, featuring a win and draw counter for an enhanced gaming experience.
- Two-Player Mode: Play against a friend on the same device.
- Win and Draw Counter: Keeps track of the number of wins for each player and the total draws.
- Responsive Design: Optimized for both desktop and mobile devices.
- Winning Logic: Automatically detects wins, draws, and updates the counters.
- Restart Option: Reset the board while retaining the win and draw counters.
- Player 1 starts as "X," and Player 2 plays as "O."
- Players take turns clicking on an empty square to place their mark.
- The first player to align three marks horizontally, vertically, or diagonally wins.
- After each game, the win counter updates for the winner, or the draw counter increments if no one wins.
- Click the "Restart" button to start a new game.
To run the game locally:
-
Clone the repository:
git clone https://github.com/sakshi13-m/game.git
-
Navigate to the project directory:
cd game -
Open the
index.htmlfile in any modern web browser:file://path-to-your-folder/index.html
No additional setup is required as this project is built with Vanilla JavaScript.
game/
├── index.html # Main HTML file
├── style.css # Stylesheet for the game design
└── script.js # JavaScript for game logic and counters
- Win Detection: Checks rows, columns, and diagonals for winning combinations.
- Counter Logic: Updates and displays the win count for Player 1 and Player 2, along with total draws.
- Dynamic Reset: Resets the board while retaining the counters for uninterrupted tracking.
Contributions are welcome! Feel free to:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name). - Commit your changes (
git commit -m "Add some feature"). - Push to the branch (
git push origin feature-name). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or suggestions, feel free to reach out:
- Email: [email protected]
- GitHub: sakshi13-m