Assume that the computer begins a game with X in the centre square and player is O.
Given a state of the game the code must :
Get the inputs from the user for the next move; if the square is empty then place an O in it and start the check to see where to place an X
Check if there is now a winning line for Y
Check to see if there is a pair of Os in a winning position, that is two Os in a column, row or diagonal and an empty square that could be filled in the next move; if so then play X in the empty square to block this winning move
If no winning sequence and no winning pair then evaluate corners in sequence and place X in first available
If no corners available then check middle squares of each column and row and place X in first available
Check if there is now a winning line for X
Check if the board is full with no winning line
else report an illegal move
User can now take his next move