tic tac toe o code example

Example 1: play tic tac toe

Always start with X in a corner. If your oppenent puts on middle, it's most 
probably a tie. All others, you win (the number next to the X / O represents 
the order):
1.
02|  |X3 
  |X2|O
X1|O1|X
 
2.
X1|  |O
O2|O1|
X2|X3|X

3.
O2|O |X3
  |X2|
X1|O1|X
  
4.
O |  |X2
  |X3|02
X1|O1|X

If he puts O in the middle, you can only hope for him to make a mistake,
or you'll tie.
If you go second, you can only hope for your opponent making a mistake.
If you can't, try for a tie !
All of this came from a youtube video, link below !

Example 2: tic tac toe

try to get to a position like

xoo
-x-
x--

then it won't matter what your opponent plays

Tags:

Cpp Example