A fully interactive and visually styled Tic-Tac-Toe (X & O) game built using vanilla JavaScript, HTML. This version includes sound effects, hover animations, custom prompts, alerts, and support for 2 players with personalized names.
- ๐งโโ๏ธ 2-player mode with custom names
- โ Custom
prompt()andalert()dialog boxes (centered on screen) - ๐จ Fully styled interface (buttons, grid, text)
- ๐ฑ๏ธ Interactive cell hover effects
- โ Win detection with highlighted cells
โ ๏ธ Draw detection- ๐ Sound effects for clicks, wins, and draws
- ๐ Restart Game and โฌ ๏ธ Home Screen buttons
- ๐ฏ Symbol selection by Player 1 (X or O)
- ๐ฎ Cursor label showing the current player's name
| Main Screen | Main Screen |
|---|---|
| Game Screen |
|---|
tic-tac-toe/
โ
โโโ index.html # Main HTML file
โโโ script.js # Contains all JavaScript code
โโโ sounds/
โ โโโ click.mp3
โ โโโ clapping.mp3
โ โโโ failed.mp3
โโโ README.md # Project documentation
- Clone or download the repository.
- Open
index.htmlin your browser (or embed script in your page). - Play!
- ๐จ You can change the styles of the grid, buttons, and background directly in
script.jsor viastyles.cssif you extract it. - ๐งโ๐ค Replace sound files (
click.mp3,clapping.mp3,failed.mp3) in thesounds/folder for a personalized experience.
- DOM Manipulation
- Event Handling
- CSS-in-JS styling
- Game state management
- Conditional rendering
- Callback-based prompts
- Custom overlay modals
- Add AI (Computer vs Player)
- Add a score counter
- Make it mobile responsive
- Save last winner using
localStorage
Created by Shruti Chandra as a part of a JavaScript learning journey.
This project is open-source and free to use for educational purposes.