I've started on a tic tac toe AI too. It looks less fuzzy, although for opponent strategy, the offensiveness and defensiveness of the opponent can be fuzzy. However, the fuzziness is overwritten by the exact values. So it is layered.
If a player has two in a row, there is no fuzziness about it, you must block. And if you have two in a row, there is no doubt you must play 3 in a row to win. It is best move to take center on your first move, but one could take a corner.
These are my notes so far before I try to implement it. I am missing a few strategies I know. I still don't think a random move is necessary.
Offense:
-if you have two in a row play 3 in a row. This checks if adjacent squares are not taken first.
-if not center taken then play center.
Else if not diagonal from center taken then play diagonally from center(check to see if they are taken and play the free one.
-Play adjacent to your pieces.
Defense:
-if opponent has two in a row, play to block.
-in other words, check which squares they have occupied, and play the unoccupied square adjacent to them.
note to self: play to block could be a dominant strategy.
Victory condition:
If you have three in a row, you win
If they have three in a row, they win
Ai Notes:
What does you win, versus they win mean?
They is opponent (no matter how many)
The logic changes when attitude is a factor.
Defensive player plays to block more often.
Offensive player plays two in a row more often.
Balanced player a balance of defense and offense.
Fuzzy values:
Offensiveness
Defensiveness
Conditions override fuzzy tendencies.