This repository contains a simple implementation of the Tic Tac Toe game using JavaScript, with two playing options: playing with a friend and playing against the computer. The computer's moves are powered by the Minimax algorithm, providing a challenging opponent.
-
Play against a friend: Enjoy a classic game of Tic Tac Toe with a friend. Take turns marking the cells until one player wins or the game ends in a draw.
-
Play against the computer: Test your skills against a strong AI opponent. The computer utilizes the Minimax algorithm to make optimal moves, providing a challenging gameplay experience.
You can try out the game by accessing the Tic Tac Toe Game Demo.
-
The game is played on a 3x3 grid.
-
There are two players: 'X' and 'O'.
-
Players take turns marking an empty cell with their symbol ('X' or 'O').
-
The goal is to get three of their symbols in a row, either horizontally, vertically, or diagonally.
-
If all cells are filled and no player has won, the game ends in a draw.
The computer opponent in the single-player mode utilizes the Minimax algorithm. Minimax is a decision-making algorithm that ensures the computer always chooses the best move to maximize its chances of winning or minimize the opponent's chances. It achieves this by searching the game tree and assigning a score to each possible move, then selecting the move with the highest score.
The implementation of the Minimax algorithm for the computer opponent was inspired by various resources and tutorials available online.
Enjoy playing Tic Tac Toe with a friend or challenge the computer's strong AI opponent!