On 3 by 3 board, first player should never lose:
"For strategy purposes, there are therefore only three possible first marks: corner, edge, or center. Player X can win or force a draw from any of these starting marks; however, playing the corner gives the opponent the smallest choice of squares which must be played to avoid losing.
The second player, whom we shall designate "O", must respond to X's opening mark in such a way as to avoid the forced win. Player O must always respond to a corner opening with a center mark, and to a center opening with a corner mark. An edge opening must be answered either with a center mark, a corner mark next to the X, or an edge mark opposite the X. Any other responses will allow X to force the win. Once the opening is completed, O's task is to follow the above list of priorities in order to force the draw, or else to gain a win if X makes a weak play."
A player can play perfect tic-tac-toe (win or draw) given they move according to the highest possible move from the following table.
1. Win: If the player has two in a row, play the third to get three in a row.
2. Block: If the opponent has two in a row, play the third to block them.
3. Fork: Create an opportunity where you can win in two ways.
4. Block opponent's fork:
* Option 1: Create two in a row to force the opponent into defending, as long as it doesn't result in them creating a fork or winning. For example, if "X" has a corner, "O" has the center, and "X" has the opposite corner as well, "O" must not play a corner in order to win. (Playing a corner in this scenario creates a fork for "X" to win.)
* Option 2: If there is a configuration where the opponent can fork, block that fork.
5. Center: Play the center.
6. Opposite corner: If the opponent is in the corner, play a center of that row or column.
7. Empty corner: Play in a corner square.
8. Empty side: Play in a middle square on any of the 4 sides.http://en.wikipedia.org/wiki/Tic-tac-toe