A simple implementation of the classic Tic-Tac-Toe game with minimax algorithm
This project is a web-based implementation of the popular Tic-Tac-Toe game. It allows two players to take turns marking the spaces in a 3x3 grid. The game includes a simple AI opponent that uses the minimax algorithm to make intelligent moves.
- Two-player gameplay mode
- AI opponent using the minimax algorithm
- Real-time status updates and win/draw notifications
Try it live here
To play the game locally, follow these steps:
-
Clone this repository:
git clone https://github.com/3ein39/odin_Tic-Tac-Toe.git
-
Open the index.html file in your web browser.
- Enter the names of the two players.
- Click "Start" to begin the game.
- Players take turns marking empty cells by clicking on them.
- The game displays the current player's turn and notifies of wins or draws.
- Click "Reset" to start a new game.
The AI opponent in this project uses the minimax algorithm to make optimal moves. The AI module contains a bestMove function that simulates possible moves and evaluates their outcomes using the minimax algorithm. The AI tries to maximize its own score while minimizing the opponent's score.