thanks xpi0t0s and shabbir..............

actually i view the tic tac to game table as a graph, where each block is a vertex of a graph and the all possible paths are connected to it

ex: there is edge between 1 to 9 , 1 to 5 , 1 to 3, 1 to 2 , 1 to 7 , 1 to 4 etc.

so the ADJACENCY LIST of graph is :

1=> 5 -> 9 -> 2 -> 3 -> 4 -> 7

2 => 5 -> 8 -> 1 -> 3

3 => 5 -> 7 -> 1 -> 2 ->6 ->9

4 => 4 -> 5 -> 6 -> 1 -> 7

5 => 2-> 8 -> 4 -> 6 -> 1 -> 9 -> 3 -> 7

6 => 5 -> 4 -> 3 -> 9

7 => 5 -> 3 -> 4 -> 1 -> 8 -> 9

8 => 5 -> 2 -> 7 -> 9

9 => 5 -> 1 -> 6 -> 3 -> 8 -> 7

win:

when user or comp. select 1 then his wining chances are:

he all ready taken (5, 9) or (2, 3) or ( 4 ,7)

comp next move:

if user has taken 2 successive places, then put X on the 3rd place.