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.
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
To run the game locally, follow these steps:
- Clone the repository:
git clone https://github.com/bek77g/tic-tac-toe.git
- Install dependencies:
npm install
- Run the development server:
npm run dev
- 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.
- 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. 🌙
- When the game starts, you'll see a 3x3 grid representing the Tic-Tac-Toe board.
- Player 1 goes first, and each player takes turns by clicking on an empty cell to place their symbol (X or O).
- The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins the game.
- If all cells are filled, and there's no winner, the game ends in a draw.
- Friend Mode: Play against a friend on the same device. 👥
- AI Mode: Challenge the AI with different 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. 😤
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.
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.
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.
This project is licensed under the MIT License. Feel free to use and modify the code as per the terms of the license.