You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

471 lines
14 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"<22>Ʒְ<C6B7>.c"
extern void jifenban();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC>ļƷְ庯<D6B0><E5BAAF>
void huanying();//<2F><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>
void printqipan();//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
void initqipan();//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void white();//<2F>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD>
void black();//<2F>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>
void startgame();//<2F><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
int panduan(int,int);//<2F>ж<EFBFBD><D0B6><EFBFBD>Ӯ<EFBFBD><D3AE><EFBFBD><EFBFBD>
int win(); //<2F><>ʾ˭Ӯ
char p[19][19][4];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int a,b,c,d,x,y,w,z,B,H;//B<><42>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD>ֵ<EFBFBD>Ӯ<EFBFBD>ּƷ<D6BC>
char ch;
int whowin;
int last;//<2F><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>λ
int main(){
huanying();
return 0;
}
void startgame() //<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><E5BAAF>
{
initqipan(); /*<2A><><EFBFBD>̳<EFBFBD>ʼ<EFBFBD><CABC>*/
while(1)
{
black();//<2F><><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><E5BAAF>
last--;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>λ
if(win()==1)//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӯ<EFBFBD><D3AE>
break;
system("cls");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
white();//<2F><><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD><E5BAAF>
last--;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>λ
if(win()==1)//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӯ<EFBFBD><D3AE>
break;
system("cls");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ
if(last==0)
win();//ƽ<>ֽ<EFBFBD><D6BD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ˭Ӯ
}
printf(" <09><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>¿<EFBFBD>ʼ<EFBFBD><CABC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺Y or N ");//ѯ<><D1AF><EFBFBD>û<EFBFBD><C3BB>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
scanf("%s",&ch);
if(ch=='Y')//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
{
system("cls");
startgame();//<2F>ٴν<D9B4><CEBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϸ
}
if(ch=='N')//<2F>˳<EFBFBD><CBB3><EFBFBD>Ϸ
{
system("cls");
printf(" ~<7E><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>~");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
jifenban();////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC>ļƷְ庯<D6B0><E5BAAF>/////////
return;
}
}
void black() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
printqipan();
printf("\n <09><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD> \n");//<2F><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>
printf(" ʾ<><CABE>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ո<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA1B1>2 3<><33><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ3<CEAA><33> \n");//<2F><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
printf(" ");
scanf("%d%d",&x,&y);
while(1)
{
6 years ago
if(x>=0&&x<=18&&y>=0&&y<=18)
{
if(strcmp(p[x][y]," ")==0)//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
6 years ago
{
strcpy(p[x][y],"<EFBFBD><EFBFBD>");//û<><C3BB><EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><C2BA><EFBFBD>
break;
}
else
printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
6 years ago
}
else printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAB3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>Χ");
6 years ago
scanf("%d%d",&x,&y);
}
system("cls");
printqipan();
printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺Y <20><><EFBFBD><EFBFBD> N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");//ѯ<><D1AF><EFBFBD>û<EFBFBD><C3BB>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
scanf("%s",&ch);
if(ch=='Y')
{
system("cls");
strcpy(p[x][y]," ");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
black();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BAAF>
}
if(ch=='N')
return;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>
}
void white() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
printqipan();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>̺<EFBFBD><CCBA><EFBFBD>
printf("\n <09><><EFBFBD>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD> \n");//<2F><><EFBFBD>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD>
printf(" ʾ<><CABE>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ո<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA1B1>2 3<><33><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ3<CEAA><33> \n");//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
printf(" ");
scanf("%d%d",&x,&y);
while(1)
{
6 years ago
if(x>=0&&x<=18&&y>=0&&y<=18)
{
if(strcmp(p[x][y]," ")==0)//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
6 years ago
{
6 years ago
strcpy(p[x][y],"<EFBFBD><EFBFBD>");//û<><C3BB><EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><C2BA><EFBFBD>
6 years ago
break;
}
else
6 years ago
printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
else printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAB3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>Χ");
6 years ago
scanf("%d%d",&x,&y);
}
system("cls");
printqipan();
printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺Y <20><><EFBFBD><EFBFBD> N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");//ѯ<><D1AF><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
scanf("%s",&ch);
if(ch=='Y')
{
strcpy(p[x][y]," ");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ
system("cls");
white();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
if(ch=='N')//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>
return;
}
int win() ///////<2F><>ʾ<EFBFBD><CABE>һ<EFBFBD><D2BB>Ӯ<EFBFBD><D3AE>
{
int havewinner=0;
int whowin;
whowin=panduan(x,y); //////<2F><>ʾ˭Ӯ<CBAD><D3AE> <20>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD> 1 <20>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD> 2
if(whowin==1)
{
havewinner=1;
printf(" \n <09>׷<EFBFBD>ʤ<EFBFBD><CAA4>\n");
B++;//<2F>Ʒ<EFBFBD>Ӯһ<D3AE><D2BB>
}
if(whowin==2)
{
havewinner=1;
printf(" \n <09>ڷ<EFBFBD>ʤ<EFBFBD><CAA4>\n");
H++;//<2F>Ʒ<EFBFBD>Ӯһ<D3AE><D2BB>
}
if(last==0&&havewinner==0)
printf("~<7E><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>~");//ƽ<><C6BD><EFBFBD><EFBFBD>ʾ
return havewinner;
}
int panduan(int x,int y)/////////////<2F>жϺ<D0B6><CFBA><EFBFBD>
{
char color[4];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B7BD><EFBFBD><EFBFBD>ɫ
int count=1;//ͳ<>Ƹ<EFBFBD><C6B8><EFBFBD>,<2C><><EFBFBD>Ե<EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>
int i=1;//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int j=1;//<2F><>iͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int winner=0;//1<><31><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD><D7B7><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>
strcpy(color,p[x][y]);
//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(strcmp(color,p[x][y-i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;count=1;
while(strcmp(color,p[x][y-i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x][y-i],"Ӯ");
i++;count++;
}
i=1;
while(strcmp(color,p[x][y+i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x][y+i],"Ӯ");
i++;count++;
}
}
}
//ˮƽ<CBAE><C6BD><EFBFBD>ұ<EFBFBD>
i=1;
while(strcmp(color,p[x][y+i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;count=1;
while(strcmp(color,p[x][y+i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x][y+i],"Ӯ");
i++;count++;
}
i=1;
while(strcmp(color,p[x][y-i])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x][y-i],"Ӯ");
i++;count++;
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
//<2F><>ֱ<EFBFBD>Ϸ<EFBFBD>
i=1;
count=1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(strcmp(color,p[x-i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;count=1;
while(strcmp(color,p[x-i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<=5)
{
strcpy(p[x-i][y],"Ӯ");
i++;count++;
}
i=1;
while(strcmp(color,p[x+i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<=5)
{
strcpy(p[x+i][y],"Ӯ");
i++;count++;
}
}
}
//<2F><>ֱ<EFBFBD>·<EFBFBD>
i=1;
while(strcmp(color,p[x+i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;count=1;
while(strcmp(color,p[x+i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<=5)
{
strcpy(p[x+i][y],"Ӯ");
i++;count++;
}
i=1;
while(strcmp(color,p[x-i][y])==0&&x>=0&&x<19&&y>=0&&y<19&&count<=5)
{
strcpy(p[x-i][y],"Ӯ");
i++;count++;
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>б<EFBFBD><D0B1> <20>Ϸ<EFBFBD>
i=1;
j=1;
count=1;
while(strcmp(color,p[x-i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
j++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;j=1;count=1;
while(strcmp(color,p[x-i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x-i][y-j],"Ӯ");
i++;j++;count++;
}
i=1;j=1;
while(strcmp(color,p[x+i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x+i][y+j],"Ӯ");
i++;j++;count++;
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>б<EFBFBD><D0B1> <20>·<EFBFBD>
i=1;
j=1;
while(strcmp(color,p[x+i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
j++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;j=1;count=1;
while(strcmp(color,p[x+i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x+i][y+j],"Ӯ");
i++;j++;count++;
}
i=1;j=1;
while(strcmp(color,p[x-i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x-i][y-j],"Ӯ");
i++;j++;count++;
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>б<EFBFBD><D0B1> <20>Ϸ<EFBFBD>
i=1;
j=1;
count=1;
while(strcmp(color,p[x-i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
j++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;j=1;count=1;
while(strcmp(color,p[x-i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x-i][y+j],"Ӯ");
i++;j++;count++;
}
i=1;j=1;
while(strcmp(color,p[x+i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x+i][y-j],"Ӯ");
i++;j++;count++;
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>б<EFBFBD><D0B1> <20>·<EFBFBD>
i=1;
j=1;
while(strcmp(color,p[x+i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
i++;
j++;
count++;
if(count==5)//<2F><><EFBFBD><EFBFBD>count<6E><74>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>˭Ӯ<CBAD>ˣ<EFBFBD><CBA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD>û<EFBFBD><C3BB>
{
if(strcmp(color,"<EFBFBD><EFBFBD>")==0)
winner=1;
else
winner=2;
strcpy(p[x][y],"Ӯ");
i=1;j=1;count=1;
while(strcmp(color,p[x+i][y-j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x+i][y-j],"Ӯ");
i++;j++;count++;
}
i=1;j=1;
while(strcmp(color,p[x-i][y+j])==0&&x>=0&&x<19&&y>=0&&y<19&&count<5)
{
strcpy(p[x-i][y+j],"Ӯ");
i++;j++;count++;
}
}
}
return winner;
}
void initqipan() /////////<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
int i,j;
for(i=0;i<19;i++)
for(j=0;j<19;j++)
strcpy(p[i][j]," ");
}
void printqipan() /*<2A><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>*/
{
int i,j;
system("color e2");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĻΪ<C4BB><CEAA><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ<EFBFBD><C9AB>
printf(" <20><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \n");
printf(" <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
for(i=0,j=0;i<18;i++,j++){
printf(" %2d <20><> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73>%2d\n",j,p[i][0],p[i][1],p[i][2],p[i][3],p[i][4],p[i][5],p[i][6],p[i][7],p[i][8],p[i][9],p[i][10],p[i][11],p[i][12],p[i][13],p[i][14],p[i][15],p[i][16],p[i][17],p[i][18],j);
printf(" <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
}
printf(" 18 <20><> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73> %s<><73>18\n",p[18][0],p[18][1],p[18][2],p[18][3],p[18][4],p[18][5],p[18][6],p[18][7],p[18][8],p[18][9],p[18][10],p[18][11],p[18][12],p[18][13],p[18][14],p[18][15],p[18][16],p[18][17],p[18][18]);
printf(" <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
printf(" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \n");
}
void huanying() //<2F><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>
{
char choice;
int i,j;
system("color e2"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĻΪdz<CEAA><C7B3>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ<EFBFBD><C9AB>
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");/*<2A><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>*/
for(i=0;i<5;i++)
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
for(i=0;i<3;i++)
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n\n");
printf(" <20><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD>ҵ<EFBFBD><D2B5>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ\n\n");
printf(" <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><E9A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7>˭<EFBFBD><CBAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");/*<2A><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>*/
printf(" <09><>ͬɫ<CDAC><C9AB><EFBFBD>ӣ<EFBFBD>˭<EFBFBD><CBAD>Ӯ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>ͺ<EFBFBD>б45<34><35><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>\n\n");
printf(" *******************************С<>ա<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ϳ<EFBFBD>Ʒ***********************************\n");
printf(" <20><><EFBFBD><EFBFBD> <20><> Ϫ <20><> <20><> <20><> <20>ף<EFBFBD><D7A3><EFBFBD> <20><> <20><> <20><> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> <20><> <20><> <20><> ׷ <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><> <20><> ɽ <20>ȡ<EFBFBD><C8A1><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> <20><> <20><> Ͽ <20><> ˮ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><> <20><> <20><><><E1B0A1><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> <20><> <20><> <20><> <20><> <20><> <20>ǣ<EFBFBD>б <20><> <20><> <20><> <20><> <20><> <20>󡣡<EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD> ʮ <20><> <20><> <20><> <20><> <20><><EFBFBD><EFBFBD>ֱ ָ <20><> <20><> б <20><> <20>ǡ<EFBFBD><C7A1><EFBFBD>\n\n");
printf(" ---<2D><><EFBFBD><EFBFBD>ʫ<EFBFBD><CAAB><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n");/*һ<>׹<EFBFBD><D7B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʫ<EFBFBD><CAAB><EFBFBD>͸<EFBFBD><CDB8><EFBFBD>Ϸ<EFBFBD>ߡ<EFBFBD>*/
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ְɡ<D6B0>\n\n");
printf(" <20><><EFBFBD>˶<EFBFBD>ս\n\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EBBFAA><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7>1.<2E><>ʼ<EFBFBD><CABC>Ϸ 2.<2E>˳<EFBFBD><CBB3><EFBFBD>Ϸ\n\n <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ǣ<EFBFBD>");/*<2A><><EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϸ<EFBFBD>Ŀ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ϸ*/
scanf("%s",&choice);
while(1){
if(choice=='1'||choice=='2')
{
if(choice=='1')
{
system("cls");
startgame(); ////////<2F><>ʼ<EFBFBD><CABC>Ϸ
}
if(choice=='2')
return ;
}
else
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");/*<2A>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><E6B7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ҫ<EFBFBD><D2AA><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
scanf("%s",&choice);
}
}