A simple yet dynamic web-based Tic Tac Toe game (X&O) built with pure HTML
, CSS
, and JavaScript
. It's quick, responsive, and features score tracking, player turn indication, and automatic game resets.
- 🎮 2-player local game (X and O)
- 🔁 Auto-reset after each round
- 🧠 Win condition detection for rows, columns, and diagonals
- 🧮 Scoreboard that resets after 10 wins
- 🎨 Colorful and responsive UI using grid layouts and modern CSS
Clone the repo
git clone https://github.com/ValyMnDul/Tic_Tac_Toe_Game.git
Enter the "Tic_Tac_Toe_Game" directory
cd Tic_Tac_Toe_Game
Open Index.html
in your browser.
And you're done!
HTML5
Grid Layout to structure the game board andUI
.CSS
:- Custom styling using colors like aqua, cyan, and antiquewhite
- Responsive grid using grid-template-columns and gap
- Large, bold typography for scores and turns
- Turn management with a
boolean
flag (turner) to toggle between X and O. - Game state tracking using flags (
C1B
toC9B
) for each cell to prevent overwriting. - Win detection through exhaustive checking of all possible winning combinations.
- Scoring system:
- Points tracked using
ScoreX
andScoreO
- Game auto-resets once a player reaches
10
points
- Points tracked using
- Hard-coded button click handlers (C1() through C9()) for individual cell control
- Refactor to use a loop or array for cells instead of 9 separate functions
- Introduce a game board array (
let board = Array(9).fill(null)
) to handle logic more cleanly - Implement local storage to persist
scores
- Add a
CPU/AI
player mode using Minimax or heuristics
Pull requests are welcome! If you'd like to contribute or suggest features, feel free to open an issue or fork the repo.