Tic-Tac-Toe game AI using Minimax algorithm with alpha-beta pruning optimization.
Heuristic/Evaluation function is such that it chooses the move that makes fastest win / slowest loss by giving score to the terminal states based on the their depth.
- User-friendly UI/UX with very smooth sliding animations.
- Choose your own marker (X/O).
- 2 modes - Play against AI 🤖 or Play against a Friend 🙋🏻♂️.
- 3 difficulty levels for playing against AI.
- Number of matches played, timer and scoreboard with the playing player highlighted.
- Strip message animation.
Responsive design, can be played on any device.
AI randomly chooses any available spot on the board.
Minimax algorithm with 30% randomness. AI can choose a random spot with 30% probability.
Minimax algorithm with alpha-beta pruning for optimization of minimax algorithm as it reduces the time complexity by pruning nodes in the minimax tree (abstract). Score to a terminal state is assigned with +- depth of that state which accounts for the closness of this terminal state to the current state. Closser terminal states means faster winning move.
- Algorithms Explained – minimax and alpha-beta pruning by Sebastian Lague (YouTube)
- GeeksforGeeks' articles on "Minimax Algorithm in Game Theory" - Set 1 | Set 2 | Set 3 | Set 4
- Minimax algorithm implementation - freecodecamp (Article)
- Tic Tac Toe Project Tutorial - freecodecamp (YouTube)
Main Menu |
Game Screen |