Skip to content

ivanho-git/TIC-TAC-TOE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Tic-Tac-Toe Web Game

Tic-Tac-Toe Demo

A modern, web-based Tic-Tac-Toe game with a competitive AI using the Minimax algorithm. Challenge the AI or play 2-player mode with your friends! Perfect for learning web development, game logic, and AI implementation.


Features ✨

  • Single-player vs AI:
    The AI plays perfectly using the Minimax algorithm. It always tries to win or block you.
  • 2-player mode:
    Play against a friend on the same device.
  • Interactive UI:
    • Hover animations
    • Color-coded X (red) and O (blue)
    • Highlight winning line
    • Smooth restart animations
  • Responsive design: Works on desktop and mobile.

How to Play 🕹️

  1. Open the index.html file in your browser.
  2. Click on an empty cell to make your move.
  3. The AI will automatically play after your move.
  4. The game announces a winner or draw when the board is full.
  5. Click Restart Game to play again.

AI Explanation 🤖

The AI uses the Minimax algorithm, a decision-making algorithm for perfect-play games.

  • The AI simulates all possible moves and chooses the one with the highest score.
  • Winning moves = +10, Losing moves = -10, Draw = 0
  • The AI blocks the player if they are about to win.
  • This ensures competitive gameplay where the AI never loses.

Folder Structure 📂

About

Simple web Tic Tac Toe game

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published