|
|
|
@ -53,16 +53,11 @@ int whom_act() //ѡ
|
|
|
|
|
}
|
|
|
|
|
int check_(char arr[3][3]) //判断棋子是否下满
|
|
|
|
|
{
|
|
|
|
|
int i = 0, j = 0, space = 0, ch = 0;
|
|
|
|
|
int i = 0, j = 0, ch = 0;
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
|
for(j = 0; j < 3; j++)
|
|
|
|
|
{
|
|
|
|
|
if(arr[i][j] == ' ') space++;
|
|
|
|
|
else ch++;
|
|
|
|
|
}
|
|
|
|
|
if(space == 9) return empty;
|
|
|
|
|
if(ch == 9) return full;
|
|
|
|
|
return unend;
|
|
|
|
|
if(arr[i][j]!=' ') ch++;
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
char judge_win(char arr[3][3]) //判断输赢,谁达到三字则返回对应的字符
|
|
|
|
|
{
|
|
|
|
@ -119,11 +114,11 @@ void mode()
|
|
|
|
|
{
|
|
|
|
|
printf("****************************\n");
|
|
|
|
|
printf("** 1. Easy **\n");
|
|
|
|
|
printf("** 2. Hard **\n");
|
|
|
|
|
printf("** 2. Normal **\n");
|
|
|
|
|
printf("****************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void computer_act_hard(char arr[3][3])
|
|
|
|
|
void computer_act_normal(char arr[3][3])
|
|
|
|
|
{
|
|
|
|
|
int value[3][3] = {{0}};
|
|
|
|
|
int i = 0, j = 0, m = 0, n = 0, count_X = 0, count_O = 0, count_ = -1;
|
|
|
|
@ -211,7 +206,7 @@ void computer_act_hard(char arr[3][3])
|
|
|
|
|
for(i = 0; i < 3; i++)
|
|
|
|
|
for(j = 0; j < 3; j++)
|
|
|
|
|
{
|
|
|
|
|
if(max < value[i][j])
|
|
|
|
|
if(max <= value[i][j])
|
|
|
|
|
{
|
|
|
|
|
max = value[i][j];
|
|
|
|
|
m = i;
|
|
|
|
|