Skip to content

techieshruti/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

79 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Tic-Tac-Toe Game

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.


โœจ Features

  • ๐Ÿงโ€โ™‚๏ธ 2-player mode with custom names
  • โ“ Custom prompt() and alert() 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

๐Ÿ“ธ Preview

Main Screen Main Screen
Start Main
Game Screen
Game

๐Ÿ“ Project Structure

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

๐Ÿš€ How to Run

  1. Clone or download the repository.
  2. Open index.html in your browser (or embed script in your page).
  3. Play!

๐Ÿ”ง Customization

  • ๐ŸŽจ You can change the styles of the grid, buttons, and background directly in script.js or via styles.css if you extract it.
  • ๐Ÿง‘โ€๐ŸŽค Replace sound files (click.mp3, clapping.mp3, failed.mp3) in the sounds/ folder for a personalized experience.

๐Ÿง  Concepts Covered

  • DOM Manipulation
  • Event Handling
  • CSS-in-JS styling
  • Game state management
  • Conditional rendering
  • Callback-based prompts
  • Custom overlay modals

๐Ÿ’ก Future Improvements

  • Add AI (Computer vs Player)
  • Add a score counter
  • Make it mobile responsive
  • Save last winner using localStorage

Author

Created by Shruti Chandra as a part of a JavaScript learning journey.


๐Ÿ“„ License

This project is open-source and free to use for educational purposes.