Tic Tac Toe Game
A classic 2-player Tic Tac Toe game built with HTML, CSS, and JavaScript, playable directly in the browser.
๐ Live Demo
https://ronitkp06-proj.github.io/tic-tac-toe/ (enable GitHub Pages in repo Settings โ Pages to activate this link)
๐ About the Project
This project is a browser-based implementation of the classic Tic Tac Toe game for two players. It focuses on core JavaScript logic โ tracking game state, detecting wins/draws, and updating the UI dynamically without any page reloads.
โจ Features
- 3x3 interactive game board
- 2-player turn-based gameplay (Player X and Player O)
- Win detection across rows, columns, and diagonals
- Draw detection when the board fills up with no winner
- โRestart Gameโ option to reset the board instantly
- Responsive, clean UI
๐ ๏ธ Built With
๐ Getting Started
To run this project locally:
# Clone the repository
git clone https://github.com/ronitkp06-proj/tic-tac-toe.git
# Navigate into the project folder
cd tic-tac-toe
# Open index.html in your browser
No additional installation or dependencies are required to play.
๐ Project Structure
tic-tac-toe/
โโโ index.html
โโโ style.css
โโโ script.js
โโโ README.md
๐ฎ How to Play
- Player X always goes first
- Click any empty cell to place your mark
- Players alternate turns until one player gets 3 in a row (horizontally, vertically, or diagonally), or the board fills up in a draw
- Click โRestartโ to play again
๐ธ Screenshots
(Add a screenshot or GIF of your project here so visitors can see it without running it)
๐ฏ What I Learned
- Managing game state with JavaScript (arrays/objects to track the board)
- Writing win/draw-checking logic and conditionals
- DOM manipulation โ updating the board dynamically based on user clicks
- Event handling for interactive UI elements
๐ค Author
Ronit