Tic tac toe help

Tic tac toe help
0.0 0


I am struck with the computers move in the tic tac toe game.Suppose the user has two pieces in the same row,column or diagonal.The computers move will be to fill the third position.Using if else condition I can do that.Other than that if you have any ideas…please share…


You can use minimax algorithm as the ai for the computer. This algorithm can take a while to understand and implement due to recursion. If you are a CS student or have a decent grasp on algorithims maybe you can implement it in a hour or two. Otherwise, a few days to implement. If you don’t have free time, I would’nt bother with minimax algorithm.