Icon - Death Star

W e l c o m e

Tic Tac Toe Game

This project was done in 2021.

A personal fun project to implement an algorithm used in Artificial Intelligence. I created a 2-player interactive tic-tac-toe game with a COM player who uses minimax algorithm to determine its next move. You can choose to play against AI or by yourself.

Logics

Some of the main logics used in this game includes:

  • A click function to trigger a series of other logics
  • An evaluation logic that compares the current state against the winning pattern
  • An AI engine that calculates a score for each scenario and uses the minimax algorithm to find the best move
  • The MinMax function recursively calls itself until it reaches the maximum depth, as there are only a limited number of patterns in a Tic Tac Toe game
Code with functions

Features

  • Displays a shadow circle or cross when hovered over
  • Indicates the winner with green for circle and orange for cross
  • Animates and flashes text to prompt for the next game
Player 2's turnPlayer 2 won

Play the game!!

Ready for a challenge? Think you can beat the COM player? Click the link above to play against the AI and put your skills to the test!