C语言五子棋游戏源代码.docx
《C语言五子棋游戏源代码.docx》由会员分享,可在线阅读,更多相关《C语言五子棋游戏源代码.docx(20页珍藏版)》请在冰豆网上搜索。
C语言五子棋游戏源代码
标准化管理处编码[BBX968T-XBB8968-NNJ668-MM9N]
#defineN10
voidwelcome();
voidinitqipan();
voidshowqi(inti);
voidsave(intp);
voidpanduan(intp);
voidheqi();
voidover();
intzouqihang();
intzouqilie();
/******************结构体*****************/
structzuobiao
{
intx[N*N];
inty[N*N];
}weizhi[N*N];
/******************主函数*****************/
voidmain()
intp=0;
welcome();
initqipan();
for(p=1;p<=N*N;p++)
weizhi[p].x[p]=zouqihang();
weizhi[p].y[p]=zouqilie();
save(p);
showqi(p);
panduan(p);
}
if(p==N*N)
heqi();
over();
/******************建立棋盘*****************/
voidinitqipan()
inti,j;
for(i=0;i{printf("%d",i);printf("");}printf("\n");for(i=1;i{for(j=0;j{if(j==0)printf("%d",i);elseprintf("·");}printf("\n");}}/******************显示棋子*****************/voidshowqi(intp){inti,j,k,m;inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=N*N;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}for(m=1;m{while(weizhi[p].x[p]==a[m]&&weizhi[p].y[p]==b[m]){printf("error!\n");weizhi[p].x[p]=zouqihang();weizhi[p].y[p]=zouqilie();m=1;}}for(i=0;i{printf("%d",i);printf("");}printf("\n");for(i=1;i{for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
printf("%d",i);
printf("");
printf("\n");
for(i=1;i{for(j=0;j{if(j==0)printf("%d",i);elseprintf("·");}printf("\n");}}/******************显示棋子*****************/voidshowqi(intp){inti,j,k,m;inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=N*N;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}for(m=1;m{while(weizhi[p].x[p]==a[m]&&weizhi[p].y[p]==b[m]){printf("error!\n");weizhi[p].x[p]=zouqihang();weizhi[p].y[p]=zouqilie();m=1;}}for(i=0;i{printf("%d",i);printf("");}printf("\n");for(i=1;i{for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
for(j=0;j{if(j==0)printf("%d",i);elseprintf("·");}printf("\n");}}/******************显示棋子*****************/voidshowqi(intp){inti,j,k,m;inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=N*N;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}for(m=1;m{while(weizhi[p].x[p]==a[m]&&weizhi[p].y[p]==b[m]){printf("error!\n");weizhi[p].x[p]=zouqihang();weizhi[p].y[p]=zouqilie();m=1;}}for(i=0;i{printf("%d",i);printf("");}printf("\n");for(i=1;i{for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
if(j==0)
else
printf("·");
/******************显示棋子*****************/
voidshowqi(intp)
inti,j,k,m;
inta[N*N],b[N*N];
FILE*fp;
fp=fopen("wuzi_list","rb");
for(i=1;i<=N*N;i++)
fread(&weizhi[i],sizeof(structzuobiao),1,fp);
a[i]=weizhi[i].x[i];
b[i]=weizhi[i].y[i];
for(m=1;m
while(weizhi[p].x[p]==a[m]&&weizhi[p].y[p]==b[m])
printf("error!
\n");
m=1;
for(i=0;i{printf("%d",i);printf("");}printf("\n");for(i=1;i{for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
for(i=1;i{for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
for(j=1;j{if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]){if(k%2==1){printf("○");break;}elseif(k%2==0){printf("●");break;}}}if(k>p)printf("·");elsecontinue;}printf("\n");}}/******************走棋行*****************/intzouqihang(){intx;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}returnx;}/******************走棋列*****************/intzouqilie(){inty;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}returny;}/******************文件保存*****************/voidsave(inti){FILE*fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);}/****************判断输赢*******************/voidpanduan(intp){inti,j,k[8]={1,1,1,1,1,1,1,1,};inta[N*N],b[N*N];FILE*fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(structzuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/for(i=1;i<=p;i++){if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[0]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[0]++;continue;}elseif(k[0]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}elseif(k[0]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}elseif((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}elseif(k[1]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[2]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[2]++;continue;}elseif(k[2]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j])){k[3]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}elseif(k[3]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}elseif(k[4]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}elseif(k[2]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[5]++;continue;}elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[5]++;continue;}elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[5]++;continue;}elseif(k[5]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)break;elseif(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}elseif(k[6]==5){printf("Player1wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}elseif(k[6]==5)break;elseif(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[7]++;continue;}elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[7]++;continue;}elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[7]++;continue;}elseif(k[7]==5){printf("Player2wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/voidheqi(){printf("************************************\n");printf("Tie!!!\n");printf("************************************\n");}/****************游戏结束*******************/voidover(){printf("************************************\n");printf("gameover!!!\n");printf("************************************\n");}/****************游戏开始*******************/voidwelcome(){printf("************************************\n");printf("Welcome!!!\n");printf("************************************\n");}
if(j==1)
for(k=1;k<=p;k++)
if(i==weizhi[k].x[k]&&j==weizhi[k].y[k])
if(k%2==1)
{printf("○");break;}
elseif(k%2==0)
{printf("●");break;}
if(k>p)printf("·");
elsecontinue;
/******************走棋行*****************/
intzouqihang()
intx;
printf("请输入要走棋子所在行数!
printf("x=");
scanf("%d",&x);
while(x>N-1||x<1)
returnx;
/******************走棋列*****************/
intzouqilie()
inty;
printf("请输入要走棋子所在列数!
printf("y=");
scanf("%d",&y);
while(y>N-1||y<1)
returny;
/******************文件保存*****************/
voidsave(inti)
fp=fopen("wuzi_list","wb");
fwrite(&weizhi[i],sizeof(structzuobiao),1,fp);
/****************判断输赢*******************/
voidpanduan(intp)
inti,j,k[8]={1,1,1,1,1,1,1,1,};
for(i=1;i<=p;i++)
/*****************判断行******************/
if(i%2==1)
for(j=1;j<=p;j=j+2)
if((a[i]==a[j])&&(b[i]==b[j]-1))
k[0]++;
continue;
elseif((a[i]==a[j])&&(b[i]==b[j]-2))
elseif((a[i]==a[j])&&(b[i]==b[j]-3))
elseif((a[i]==a[j])&&(b[i]==b[j]-4))
elseif(k[0]==5)
printf("Player1wins!
!
if(k[0]==5)
break;
k[0]=1;
elseif(i%2==0)
for(j=2;j<=p;j=j+2)
k[1]++;
elseif(k[1]==5)
printf("Player2wins!
if(k[1]==5)
k[1]=1;
/**********************判断列************************/
if(k[0]==5||k[1]==5)
elseif(i%2==1)
if((a[i]==a[j]-1)&&(b[i]==b[j]))
k[2]++;
elseif((a[i]==a[j]-2)&&(b[i]==b[j]))
elseif((a[i]==a[j]-3)&&(b[i]==b[j]))
elseif((a[i]==a[j]-4)&&(b[i]==b[j]))
elseif(k[2]==5)
if(k[2]==5)
k[2]=1;
k[3]++;
elseif(k[3]==5)
if(k[3]==5)
k[3]=1;
/****************判断对角(左上-右下)******************/
if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)
if((a[i]==a[j]-1)&&(b[i]==b[j]-1))
k[4]++;
elseif((a[i]==a[j]-2)&&(b[i]==b[j]-2))
elseif((a[i]==a[j]-3)&&(b[i]==b[j]-3))
elseif((a[i]==a[j]-4)&&(b[i]==b[j]-4))
elseif(k[4]==5)
if(k[4]==5)
k[4]=1;
k[5]++;
elseif(k[5]==5)
if(k[5]==5)
k[5]=1;
/**********判断对角(左下-右上)************/
if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5)
if((a[i]==a[j]+1)&&(b[i]==b[j]-1))
k[6]++;
elseif((a[i]==a[j]+2)&&(b[i]==b[j]-2))
elseif((a[i]==a[j]+3)&&(b[i]==b[j]-3))
elseif((a[i]==a[j]+4)&&(b[i]==b[j]-4))
elseif(k[6]==5)
if(k[6]==5)
k[6]=1;
k[7]++;
elseif(k[7]==5)
if(k[7]==5)
k[7]=1;
/****************和棋*******************/
voidheqi()
printf("************************************\n");
printf("Tie!
/****************游戏结束*******************/
voidover()
printf("gameover!
/****************游戏开始*******************/
voidwelcome()
printf("Welcome!
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1