Welcome to the Tic-Tac-Toe game! This project features a modern and sleek UI, with two gameplay modes: Play against AI and Play with a Friend. The game is built using HTML, CSS, and JavaScript, offering a responsive and interactive experience.
- 🎲 Single-Player Mode: Play against an unbeatable AI using the Minimax algorithm with heuristics to ensure optimal and fast decisions.
- 👥 Two-Player Mode: Play with a friend and track player names.
- 🖼️ Dynamic UI: Modern, responsive design with hover effects and animations.
- 🎉 Endgame Popup: Displays the result of the game (win, lose, or draw) in a stylish popup with a restart option.
- 🔄 Reset and Home Navigation: Easily reset the board without losing initial selections or navigate back to the home screen.
The game leverages the Minimax algorithm for its AI in single-player mode. The Minimax algorithm is a recursive strategy used in decision-making and game theory. It ensures that the AI makes optimal moves by simulating all possible game outcomes, minimizing the possible loss in a worst-case scenario.
To speed up the decision-making process, heuristics are applied to prune unnecessary branches in the decision tree, making the AI fast and efficient.
The game is hosted and can be played online at: Click To Play
- Choose Your Symbol: Select
X
orO
. - Choose Who Goes First: Decide whether you or the AI makes the first move.
- Make Your Move: Play the game with visual feedback and AI moves.
- Endgame Popup: The result will be displayed in a popup when the game ends.
- Enter Player Names: Customize your names or use the default (
Player 1
andPlayer 2
). - Play the Game: Alternate turns and enjoy the hover effects showing whose turn it is.
- Endgame Popup: The result will be displayed in a popup when the game ends.
📁 tic-tac-toe/
├── 📄 index.html # Main HTML file
├── 📄 style.css # Stylesheet for the game
└── 📄 script.js # JavaScript logic for the game
- Clone the Repository:
git clone https://github.com/aminshahid573/Unbeatable-Tic-Tac-Toe.git
- Navigate to the Project Folder:
cd Unbeatable-Tic-Tac-Toe
- Open
index.html
in Your Browser: Just open theindex.html
file in your preferred browser and start playing!
[Insert Image Here]
[Insert Image Here]
[Insert Image Here]
- HTML5: For structuring the content of the game.
- CSS3: For styling, hover effects, and responsive design.
- JavaScript: For game logic, AI implementation, and interactivity.
- Difficulty Levels: Add multiple difficulty settings for AI.
- Score Tracking: Implement a scoreboard to track wins and losses.
- Mobile Optimizations: Further improve the responsiveness for smaller devices.
Contributions are welcome! If you’d like to improve this project, please fork the repository and submit a pull request.
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
). - Commit your Changes (
git commit -m 'Add some AmazingFeature'
). - Push to the Branch (
git push origin feature/AmazingFeature
). - Open a Pull Request.
Distributed under the MIT License. See LICENSE
for more information.
- Name: Shahid Amin
- Email: aminshahid5515@gmail.com
- GitHub: https://github.com/aminshahid573