Skip to content

Play Tic-Tac-Toe against a friend or challenge the AI with different difficulty levels in this simple JavaScript-based game with a dark mode option

Notifications You must be signed in to change notification settings

bek77g/tic-tac-toe

Repository files navigation

Tic-Tac-Toe Game 😄🎮

This is a simple Tic-Tac-Toe game built using JavaScript and CSS. It allows players to play against each other or against an AI. The game offers different difficulty levels: Easy, Medium, and Hard.

Website

The Tic Tac Toe Game website is hosted on GitHub Pages. You can access the game by visiting the following link: Tic Tac Toe Game

Getting Started 🚀

To run the game locally, follow these steps:

  1. Clone the repository: git clone https://github.com/bek77g/tic-tac-toe.git
  2. Install dependencies: npm install
  3. Run the development server: npm run dev
  4. Vite will automatically open your default browser with the local server running. You can view the game by following the URL shown in the console, which will include a randomly assigned port number.

Features 🌟

  • Play against a friend or challenge the AI.
  • Three difficulty levels to choose from: Easy, Medium, and Hard.
  • Toggle dark mode for a more comfortable gaming experience. 🌙

How to Play 🎯

  1. When the game starts, you'll see a 3x3 grid representing the Tic-Tac-Toe board.
  2. Player 1 goes first, and each player takes turns by clicking on an empty cell to place their symbol (X or O).
  3. The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins the game.
  4. If all cells are filled, and there's no winner, the game ends in a draw.

Game Modes 🕹️

  • Friend Mode: Play against a friend on the same device. 👥
  • AI Mode: Challenge the AI with different difficulty levels. 🤖

Difficulty Levels 🌟

  • Easy: The AI makes random moves. 😅
  • Medium: The AI tries to win but can be blocked easily. 😎
  • Hard: The AI makes strategic moves and is challenging to beat. 😤

Tech Stack 💻

The project uses the following technologies:

  • Vite.js: A fast build tool and development server.
  • JavaScript: The primary programming language.
  • CSS: For styling the user interface.

Scripts 📜

  • npm run dev: Starts the development server.
  • npm run build: Builds the project for production.
  • npm run preview: Serves the production build locally for preview.

Contribution 🤝

Contributions to this project are welcome. If you find any issues or have suggestions for improvements, feel free to open a new issue or submit a pull request.

License 📝

This project is licensed under the MIT License. Feel free to use and modify the code as per the terms of the license.

About

Play Tic-Tac-Toe against a friend or challenge the AI with different difficulty levels in this simple JavaScript-based game with a dark mode option

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published