Skip to content

Play a classic Tic-Tac-Toe game in your browser with a sleek design using HTML, CSS, and JavaScript!

Notifications You must be signed in to change notification settings

deepshika-babu/Tic-Tac-Toe-Game

Repository files navigation

Tic Tac Toe Game

This is a simple and interactive Tic Tac Toe game built using HTML, CSS, and JavaScript. The game allows two players to play against each other, taking turns to mark X or O on a 3x3 grid. The first player to align three of their marks horizontally, vertically, or diagonally wins the game.

Technologies Used

  • HTML5
  • CSS3
  • JavaScript

Features

  • Interactive 3x3 grid for gameplay.
  • Dynamic turn switching between X and O.
  • Display of the current player's turn.
  • Reset button to start a new game.
  • Winning line animation when a player wins.
  • Sound effects for game actions (turn change and game over).
  • Simple and responsive design.

Files Included

  • index.html: The main HTML structure of the game.
  • style.css: The stylesheet for styling the game.
  • script.js: The JavaScript file containing game logic.
  • bg.jpg: Background image for the game.
  • cheer-happy.gif: Animation displayed when a player wins.
  • music.mp3, ting.mp3, gameover.mp3: Audio files for background music, turn change, and game over.

How to Play

  1. Open the index.html file in a web browser.
  2. The game starts with player X. The current player's turn is displayed at the top.
  3. Click on any empty box in the grid to place your mark.
  4. The turn will automatically switch to the other player (O or X) after each move.
  5. The game checks for a winning combination after every move. If a player wins, the winning line is displayed, and a congratulatory animation is shown.
  6. Click the "Reset" button to start a new game.

Game Demo

Game Logic

  • The game alternates turns between player X and player O.
  • A player wins by aligning three of their marks in a row, column, or diagonal.
  • The game is reset when the "Reset" button is clicked.

Installation

No installation is required. Simply download the files and open index.html in any modern web browser to play.

Screenshots

Opening Page Player O Wins the Game

About

Play a classic Tic-Tac-Toe game in your browser with a sleek design using HTML, CSS, and JavaScript!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published