1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
string TicTac[3][3]=
{
{" "," "," "},
{" "," "," "},
{" "," "," "}
};
int comp_col[] ={1,0,2,2,0,1,0,2,1};
int comp_row[] ={1,0,2,0,2,0,1,1,2};
void computer_move()
{
int up = 0, col, rows;
do{
comp_col[up] = col;
comp_row[up] = rows;
up++;
}while(TicTac[rows][col] != "X" && TicTac[rows][col] != "O");
TicTac[rows][col] = player;
Check();
turn();
}
|