Skip to content

JeraldPascual/XO-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game

Overview

This is a simple implementation of the classic Tic-Tac-Toe game using HTML, CSS, and JavaScript. Players take turns to place 'X' and 'O' on a 3x3 grid, and the first player to align three of their marks in a row, column, or diagonal wins the game.

Features

  • Interactive 3x3 game board
  • Player turns displayed with 'X' and 'O'
  • Win detection for rows, columns, and diagonals
  • Draw detection if the board is filled
  • Reset button to start a new game

How to Play

  1. Open index.html in a web browser.
  2. Players take turns clicking on the empty cells to place their marks ('X' or 'O').
  3. The game checks for a winner after each move.
    • If a player aligns three marks in a row, column, or diagonal, an alert will display the winner.
    • If all cells are filled and no one wins, an alert will display that the game is a draw.
  4. Click the "Reset" button to clear the board and start a new game.

Files

  • index.html: Contains the HTML structure of the game.
  • styles.css: Contains the CSS for styling the game board and other elements.
  • script.js: Contains the JavaScript logic for handling player moves, checking for winners, and resetting the game.

Getting Started

Clone the Repository

To get a copy of the project up and running on your local machine, you can clone the repository with the following command:

git clone https://github.com/your-username/tic-tac-toe.git

Replace https://github.com/your-username/tic-tac-toe.git with your actual repository URL.

Open the Project

  1. Navigate to the project directory:
cd tic-tac-toe
  1. Open the index.html file in your web browser to play the game.

Credits

This project was developed to practice fundamental front-end development skills, including HTML, CSS, and JavaScript.

Enjoy playing Tic-Tac-Toe!