simple game with AI
If both players are playing with an optimal strategy, every game will end in a tie.
X is always the first player, you can choose the X or O to be the unbeatable AI.
-
if one player fills the center, the other should choose one of the corners
-
if one player fills one of the corners, the other should choose the center
-
if one player fills one of the four edges, the other one should choose cell that are in the same row or column with the chosen one.
MinMax: here is a good post about how the algorithm works