X score
O score
minimax algorithm is use to calculate the each move possibilities for each tiles that makes the AI unbeatable, good luck!
don't worry, this ai just pick a random tiles to choose, beat him up!
minimax algorithm is use to calculate the each move possibilities for each tiles that makes the AI unbeatable, good luck!
don't worry, this AI is just pick a random tiles to choose, beat him up!
The SmartAI use minimax algorithm to predict which next move who gains higher/lower score. in this case, i use the lower score for the O turn, which is required for second turn. minimax algorithm use recursive function to predict next moves and evaluated board by evaluation function(check who winner function) and then the score is returned. the minimax algorithm create exponential branch to predict each moves, which is why it's so unefficient when you use this algorithm for more complex game, like chess and go for example. so you must use other algorithm or more preferably by other people is to add some other algorithm like alpha-beta pruning.
this ai is just pick a random tiles to chose which next move. nothing interesting though.
Source Code: https://github.com/NGC-1512/NGC-1512.github.io