这是C语言版的代码,编译运行成可执行文件后,还需下载一个软件,才可人机对战,这个软件的下载地址如下:/RATE/news/Gobang_Human_VS_AI.rar,代码如下:
/* Program of Game -- wuziqi Written by Zhang shuai, DEC.25th, */#include<iostream.h>#include<stdlib.h>#include<string.h>#include<time.h>const int BOARDSIZE = 15; //棋盘大小 int X,Y;int board[BOARDSIZE][BOARDSIZE]; //棋盘信息,-1表示空,1表示黑棋占据,2表示白棋占据 int colour; //用于保存己方颜色 int temp1,temp2,temp3,count;int checkMax(int x, int y,int black_or_white){int num=0,max_num,max_temp=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge rightfor(i=1;i<5;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}//judge leftx_temp1=x_temp;for(i=1;i<5;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(num<5)max_temp=num;//judge upx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<5;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}//judge downy_temp1=y_temp;for(i=1;i<5;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(num>max_temp&&num<5)max_temp=num;//judge left_upx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<5;i++){x_temp1-=1;y_temp1-=1;if(y_temp1<0 || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}//judge right_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<5;i++){x_temp1+=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(num>max_temp&&num<5)max_temp=num;//judge right_upx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<5;i++){x_temp1+=1;y_temp1-=1;if(y_temp1<0 || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}//judge left_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<5;i++){x_temp1-=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(num>max_temp&&num<5)max_temp=num;max_num=max_temp;return max_num;}//判断 三三类型bool san_san(int x,int y,int black_or_white){int flag1=0,flag2=0,flag3=0,flag4=0,flag5=0,flag6=0,flag7=0,flag8=0,flag9=0,flag10=0,flag11=0,flag12=0;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge upif(x_temp1>=4){if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)flag1=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)flag1=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1)flag1=1;}if(x_temp1>=4&&x_temp1<=BOARDSIZE-1)if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1)flag1=1; //judge downx_temp1=x_temp;if(x_temp1<BOARDSIZE-4){if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)flag2=1;else if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1)flag2=1;}if(x_temp1>=1&&x_temp1<BOARDSIZE-4)if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1)flag2=1;if(x_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1)flag9=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white)flag9=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1)flag9=1;}//judge leftx_temp1=x_temp;if(y_temp1>=4){if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)flag3=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)flag3=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1)flag3=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1)if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1)flag3=1;//judge righty_temp1=y_temp;if(y_temp1<BOARDSIZE-4){if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)flag4=1;else if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1)flag4=1;}if(y_temp1>=1&&y_temp1<BOARDSIZE-4)if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1)flag4=1;if(y_temp1>=2&&y_temp1<BOARDSIZE-2){if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1)flag10=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white)flag10=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1)flag10=1;}//judge left_upx_temp1=x_temp;y_temp1=y_temp;if(y_temp1>=4&&x_temp1>=4){if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)flag5=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)flag5=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1)flag5=1;}if(y_temp1>=4&&x_temp1>=4&&y_temp1<BOARDSIZE-1&&x_temp1<BOARDSIZE-1)if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1)flag5=1;//judge right_downif(y_temp1<BOARDSIZE-4&&x_temp1<BOARDSIZE-4){if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)flag6=1;else if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)flag6=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1)flag6=1;}if(y_temp1>=1&&x_temp1>=1&&y_temp1<BOARDSIZE-4&&x_temp1<BOARDSIZE-4)if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1)flag6=1;if(y_temp1>=2&&y_temp1<BOARDSIZE-2&&x_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1)flag11=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white)flag11=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1)flag11=1;}//judge left_downx_temp1=x_temp;y_temp1=y_temp;if(y_temp1>=4&&x_temp1<BOARDSIZE-4){if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)flag7=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)flag7=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1)flag7=1;}if(y_temp1>=4&&x_temp1>=1&&y_temp1<BOARDSIZE-1&&x_temp1<BOARDSIZE-4)if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1)flag7=1;//judge right_upx_temp1=x_temp;y_temp1=y_temp;if(y_temp1<BOARDSIZE-4&&x_temp1>=4){if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)flag8=1;else if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)flag8=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1)flag8=1;}if(y_temp1>=1&&x_temp1>=4&&y_temp1<BOARDSIZE-4&&x_temp1<BOARDSIZE-1)if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1)flag8=1;if(y_temp1>=2&&y_temp1<BOARDSIZE-2&&x_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1)flag12=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white)flag12=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1)flag12=1;}if(flag1+flag2+flag3+flag4+flag5+flag6+flag7+flag8+flag9+flag10+flag11+flag12>=2){return true;}return false;}//判断四三类型bool si_san(int x,int y,int black_or_white){int flag1=0,flag2=0,flag3=0,flag4=0,flag5=0,flag6=0,flag7=0,flag8=0;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge right_left_sanif(x_temp1<BOARDSIZE-4&&x_temp1>=1){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)flag1=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1)flag1=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)flag1=1;}if(x_temp1>=4){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)flag1=1;else if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1)flag1=1;else if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)flag1=1;}if(x_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1)flag1=1;else if(board[x_temp1-2][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white)flag1=1;else if(board[x_temp1+2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white)flag1=1;}// judge right_left_siif(x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-4&&x_temp1>=1){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-3&&x_temp1>=2){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-2&&x_temp1>=3){if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=5){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=4&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=3&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=2&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==3-black_or_white)flag2=1;}//judge up_down_sanif(y_temp1<BOARDSIZE-4&&y_temp1>=1){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)flag3=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1)flag3=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)flag3=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)flag3=1;else if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1)flag3=1;else if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)flag3=1;}if(y_temp1>=2&&y_temp1<BOARDSIZE-2){if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1)flag3=1;else if(board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white)flag3=1;else if(board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white)flag3=1;}//judge up_down_siif(y_temp1<BOARDSIZE-5){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-4&&y_temp1>=1){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-3&&y_temp1>=2){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-2&&y_temp1>=3){if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==3-black_or_white)flag4=1;}if(y_temp1>=5){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;}if(y_temp1>=3&&y_temp1<BOARDSIZE-2){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;}if(y_temp1>=2&&y_temp1<BOARDSIZE-3){if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==3-black_or_white)flag4=1;}//judge D_L_R_U_sanif(y_temp1<BOARDSIZE-4&&y_temp1>=1&&x_temp1>=4&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)flag5=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1)flag5=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)flag5=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1&&x_temp1>=1&&x_temp1<BOARDSIZE-4){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)flag5=1;else if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1)flag5=1;else if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)flag5=1;}if(y_temp1>=2&&y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2&&x_temp1>=2){if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1)flag5=1;else if(board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white)flag5=1;else if(board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white)flag5=1;}//judge D_L_R_U_siif(y_temp1<BOARDSIZE-5&&x_temp1>=5){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-4&&x_temp1>=4&&y_temp1>=1&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-3&&x_temp1>=3&&y_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-2&&x_temp1>=2&&y_temp1>=3&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==3-black_or_white)flag6=1;}if(y_temp1>=5&&x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;}if(y_temp1>=4&&x_temp1<BOARDSIZE-4&&y_temp1<BOARDSIZE-1&&x_temp1>=1){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;}if(y_temp1>=3&&x_temp1<BOARDSIZE-3&&y_temp1<BOARDSIZE-2&&x_temp1>=2){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;}if(y_temp1>=2&&x_temp1<BOARDSIZE-2&&y_temp1<BOARDSIZE-3&&x_temp1>=3){if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==3-black_or_white)flag6=1;}//judge L_U_R_D_sanif(y_temp1<BOARDSIZE-4&&y_temp1>=1&&x_temp1>=4&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)flag7=1;else if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1)flag7=1;else if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)flag7=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1&&x_temp1>=1&&x_temp1<BOARDSIZE-4){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)flag7=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1)flag7=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)flag7=1;}if(y_temp1>=2&&y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2&&x_temp1>=2){if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1)flag7=1;else if(board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white)flag7=1;else if(board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white)flag7=1;}//judge L_U_R_D_siif(y_temp1<BOARDSIZE-5&&x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-4&&x_temp1<BOARDSIZE-4&&y_temp1>=1&&x_temp1>=1){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-3&&x_temp1<BOARDSIZE-3&&y_temp1>=2&&x_temp1>=2){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2&&y_temp1>=3&&x_temp1>=3){if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==3-black_or_white)flag8=1;}if(y_temp1>=5&&x_temp1>=5){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;}if(y_temp1>=4&&x_temp1>=4&&y_temp1<BOARDSIZE-1&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;}if(y_temp1>=3&&x_temp1>=3&&y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;}if(y_temp1>=2&&x_temp1>=2&&y_temp1<BOARDSIZE-3&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==3-black_or_white)flag8=1;}if(flag1+flag3+flag5+flag7>=1&&flag2+flag4+flag6+flag8>=1&&flag1+flag2<2&&flag3+flag4<2&&flag5+flag6<2&&flag7+flag8<2)return true;return false;}//判断四四类型bool si_si(int x,int y,int black_or_white){int flag2=0,flag4=0,flag6=0,flag8=0;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;// judge right_left_siif(x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1&&board[x_temp1+4][y_temp1]==black_or_white&&board[x_temp1+5][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-4&&x_temp1>=1){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-3&&x_temp1>=2){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1<BOARDSIZE-2&&x_temp1>=3){if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=5){if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1&&board[x_temp1-4][y_temp1]==black_or_white&&board[x_temp1-5][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=4&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=3&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==3-black_or_white)flag2=1;}if(x_temp1>=2&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==3-black_or_white)flag2=1;else if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==3-black_or_white)flag2=1;}//judge up_down_siif(y_temp1<BOARDSIZE-5){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1&&board[x_temp1][y_temp1+4]==black_or_white&&board[x_temp1][y_temp1+5]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-4&&y_temp1>=1){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-3&&y_temp1>=2){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-2&&y_temp1>=3){if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==3-black_or_white)flag4=1;}if(y_temp1>=5){if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1&&board[x_temp1][y_temp1-4]==black_or_white&&board[x_temp1][y_temp1-5]==3-black_or_white)flag4=1;}if(y_temp1>=4&&y_temp1<BOARDSIZE-1){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==3-black_or_white)flag4=1;}if(y_temp1>=3&&y_temp1<BOARDSIZE-2){if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==3-black_or_white)flag4=1;}if(y_temp1>=2&&y_temp1<BOARDSIZE-3){if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==3-black_or_white)flag4=1;else if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==3-black_or_white)flag4=1;}if(y_temp1<BOARDSIZE-5&&x_temp1>=5){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1&&board[x_temp1-4][y_temp1+4]==black_or_white&&board[x_temp1-1][y_temp1+5]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-4&&x_temp1>=4&&y_temp1>=1&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-3&&x_temp1>=3&&y_temp1>=2&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==3-black_or_white)flag6=1;}if(y_temp1<BOARDSIZE-2&&x_temp1>=2&&y_temp1>=3&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==3-black_or_white)flag6=1;}if(y_temp1>=5&&x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;else if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1&&board[x_temp1+4][y_temp1-4]==black_or_white&&board[x_temp1+5][y_temp1-5]==3-black_or_white)flag6=1;}if(y_temp1>=4&&x_temp1<BOARDSIZE-4&&y_temp1<BOARDSIZE-1&&x_temp1>=1){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==3-black_or_white)flag6=1;}if(y_temp1>=3&&x_temp1<BOARDSIZE-3&&y_temp1<BOARDSIZE-2&&x_temp1>=2){if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==3-black_or_white)flag6=1;}if(y_temp1>=2&&x_temp1<BOARDSIZE-2&&y_temp1<BOARDSIZE-3&&x_temp1>=3){if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==3-black_or_white)flag6=1;else if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==3-black_or_white)flag6=1;}//judge L_U_R_D_siif(y_temp1<BOARDSIZE-5&&x_temp1<BOARDSIZE-5){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1&&board[x_temp1+4][y_temp1+4]==black_or_white&&board[x_temp1+5][y_temp1+5]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-4&&x_temp1<BOARDSIZE-4&&y_temp1>=1&&x_temp1>=1){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-3&&x_temp1<BOARDSIZE-3&&y_temp1>=2&&x_temp1>=2){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==3-black_or_white)flag8=1;}if(y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2&&y_temp1>=3&&x_temp1>=3){if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==3-black_or_white)flag8=1;}if(y_temp1>=5&&x_temp1>=5){if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;else if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1&&board[x_temp1-4][y_temp1-4]==black_or_white&&board[x_temp1-5][y_temp1-5]==3-black_or_white)flag8=1;}if(y_temp1>=4&&x_temp1>=4&&y_temp1<BOARDSIZE-1&&x_temp1<BOARDSIZE-1){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==3-black_or_white)flag8=1;}if(y_temp1>=3&&x_temp1>=3&&y_temp1<BOARDSIZE-2&&x_temp1<BOARDSIZE-2){if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==3-black_or_white)flag8=1;}if(y_temp1>=2&&x_temp1>=2&&y_temp1<BOARDSIZE-3&&x_temp1<BOARDSIZE-3){if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==3-black_or_white)flag8=1;else if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==3-black_or_white)flag8=1;}if(flag2+flag4+flag6+flag8>=2)return true;return false;}//判断死二类型bool si_er(int x,int y,int black_or_white){int num=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge left_upfor(i=1;i<3;i++){x_temp1-=1;y_temp1+=1;if(x_temp1<0||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||y_temp1==BOARDSIZE-1||x_temp==BOARDSIZE-2||y_temp==1)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-3&&y_temp>=2&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1-1][y_temp1+1]==3-black_or_white&&board[x_temp+1][y_temp-1]==-1&&board[x_temp+2][y_temp-2]==-1)return true;//judge right_downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1-=1;if(x_temp1>=BOARDSIZE||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==BOARDSIZE-1||y_temp1==0||x_temp==1||y_temp==BOARDSIZE-2)return false;elseif(x_temp>=2&&x_temp1<=BOARDSIZE-2&&y_temp1>=1&&y_temp<=BOARDSIZE-3)if(num==2&&board[x_temp1+1][y_temp1-1]==3-black_or_white&&board[x_temp-1][y_temp+1]==-1&&board[x_temp-2][y_temp+2]==-1)return true;//judge left_downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;y_temp1-=1;if(x_temp1<0||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||y_temp1==0||x_temp==BOARDSIZE-2||y_temp==BOARDSIZE-2)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-3&&y_temp1>=1&&y_temp<=BOARDSIZE-4)if(num==2&&board[x_temp1-1][y_temp1-1]==3-black_or_white&&board[x_temp+1][y_temp+1]==-1&&board[x_temp+2][y_temp+2]==-1)return true;//judge right_upnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1+=1;if(x_temp1>=BOARDSIZE||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==BOARDSIZE-1||y_temp1==BOARDSIZE-1||x_temp==1||y_temp==1)return false;elseif(x_temp>=2&&x_temp1<=BOARDSIZE-2&&y_temp>=2&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1+1][y_temp1+1]==3-black_or_white&&board[x_temp-1][y_temp-1]==-1&&board[x_temp-2][y_temp-2]==-1)return true;//judge rightnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp==1||x_temp1==BOARDSIZE-1)return false;elseif(x_temp>=2&&x_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1+1][y_temp1]==3-black_or_white&&board[x_temp-1][y_temp]==-1&&board[x_temp-2][y_temp]==-1)return true;//judeg leftnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||x_temp==BOARDSIZE-2)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-3)if(num==2&&board[x_temp1-1][y_temp1]==3-black_or_white&&board[x_temp+1][y_temp]==-1&&board[x_temp+2][y_temp]==-1)return true;//judge upnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(y_temp==1||y_temp1==BOARDSIZE-1)return false;elseif(y_temp>=2&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1][y_temp1+1]==3-black_or_white&&board[x_temp][y_temp-1]==-1&&board[x_temp][y_temp-2]==-1)return true;//judge downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(y_temp1==1||y_temp==BOARDSIZE-1)return false;elseif(y_temp1>=2&&y_temp<=BOARDSIZE-2)if(num==2&&board[x_temp1][y_temp1-1]==3-black_or_white&&board[x_temp][y_temp+1]==-1&&board[x_temp][y_temp+2]==-1)return true;return false;}//判断端连活二类型bool duan_lian_huo_er(int x,int y,int black_or_white){int num=0,i;int x_temp1=x,y_temp1=y;if(x_temp1<BOARDSIZE-1&&x_temp1>=4)if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==-1&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1)if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==-1&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)return true;if(y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)return true;if(y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)return true;if(x_temp1<BOARDSIZE-1&&x_temp1>=4&&y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)return true;if(x_temp1<BOARDSIZE-1&&x_temp1>=4&&y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1&&y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1&&y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)return true;return false;}//判断活二类型bool huo_er(int x,int y,int black_or_white){int num=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge left_upfor(i=1;i<3;i++){x_temp1-=1;y_temp1+=1;if(x_temp1<0||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||y_temp1==BOARDSIZE-1||x_temp1==BOARDSIZE-1||y_temp==0)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-2&&y_temp>=1&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1-1][y_temp1+1]==-1&&board[x_temp+1][y_temp-1]==-1)return true;//judge right_downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1-=1;if(x_temp1>=BOARDSIZE||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==BOARDSIZE-1||y_temp1==0||x_temp==0||y_temp1==BOARDSIZE-1)return false;elseif(x_temp>=1&&x_temp1<=BOARDSIZE-2&&y_temp1>=1&&y_temp<=BOARDSIZE-2)if(num==2&&board[x_temp1+1][y_temp1-1]==-1&&board[x_temp-1][y_temp+1]==-1)return true;//judge left_downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;y_temp1-=1;if(x_temp1<0||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||y_temp1==0||x_temp1==BOARDSIZE-1||y_temp1==BOARDSIZE-1)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-2&&y_temp1>=1&&y_temp<=BOARDSIZE-2)if(num==2&&board[x_temp1-1][y_temp1-1]==-1&&board[x_temp+1][y_temp+1]==-1)return true;//judge right_upnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1+=1;if(x_temp1>=BOARDSIZE||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==BOARDSIZE-1||y_temp1==BOARDSIZE-1||x_temp==0||y_temp==0)return false;elseif(x_temp>=1&&x_temp1<=BOARDSIZE-2&&y_temp>=1&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1+1][y_temp1+1]==-1&&board[x_temp-1][y_temp-1]==-1)return true;//judge rightnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp==0||x_temp1==BOARDSIZE-1)return false;elseif(x_temp>=1&&x_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1+1][y_temp1]==-1&&board[x_temp-1][y_temp]==-1)return true;//judeg leftnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(x_temp1==0||x_temp==BOARDSIZE-1)return false;elseif(x_temp1>=1&&x_temp<=BOARDSIZE-2)if(num==2&&board[x_temp1-1][y_temp1]==-1&&board[x_temp+1][y_temp]==-1)return true;//judge upnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(y_temp==0||y_temp1==BOARDSIZE-1)return false;elseif(y_temp>=1&&y_temp1<=BOARDSIZE-2)if(num==2&&board[x_temp1][y_temp1+1]==-1&&board[x_temp][y_temp-1]==-1)return true;//judge downnum=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;elsebreak;}if(y_temp1==0||y_temp==BOARDSIZE-1)return false;elseif(y_temp1>=1&&y_temp<=BOARDSIZE-2)if(num==2&&board[x_temp1][y_temp1-1]==-1&&board[x_temp][y_temp+1]==-1)return true;return false;}//判断十字二类型bool shi_zi_er(int x,int y,int black_or_white){int num1=0,num2=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge rightfor(i=1;i<3;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}//judeg downx_temp1=x_temp;for(i=1;i<3;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;//judge rightnum1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}//judge upx_temp1=x_temp;for(i=1;i<3;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;//judge leftnum1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}//judge downx_temp1=x_temp;for(i=1;i<3;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;//judge leftnum1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}//judge upx_temp1=x_temp;for(i=1;i<3;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;return false;}//判断斜字二类型bool xie_zi_er(int x,int y,int black_or_white){int num1=0,i,num2=0;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1-=1;if(x_temp1>=BOARDSIZE||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1-=1;x_temp1-=1;if(y_temp1<0||x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;num1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;y_temp1+=1;if(x_temp1<0||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1-=1;x_temp1-=1;if(y_temp1<0||x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;num1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1+=1;y_temp1-=1;if(x_temp1>=BOARDSIZE||y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1+=1;x_temp1+=1;if(y_temp1>=BOARDSIZE||x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;num1=0;num2=0;x_temp=x;y_temp=y;x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){x_temp1-=1;y_temp1+=1;if(x_temp1<0||y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}x_temp1=x_temp;y_temp1=y_temp;for(i=1;i<3;i++){y_temp1+=1;x_temp1+=1;if(y_temp1>=BOARDSIZE||x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num1==1&&num2==1)return true;return false;}//判断活断二类型bool huo_duan_er(int x,int y,int black_or_white){int x_temp,y_temp;x_temp=x;y_temp=y;//judge left_rightif(x_temp>=2&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp]==black_or_white&&board[x_temp-2][y_temp]==-1&&board[x_temp+1][y_temp]==black_or_white&&board[x_temp+2][y_temp]==-1)return true;if(x_temp>=2&&x_temp<=BOARDSIZE-4)if(board[x_temp-1][y_temp]==black_or_white&&board[x_temp-2][y_temp]==-1&&board[x_temp+1][y_temp]==-1&&board[x_temp+2][y_temp]==black_or_white&&board[x_temp+3][y_temp]==-1)return true;if(x_temp>=3&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp]==-1&&board[x_temp-2][y_temp]==black_or_white&&board[x_temp-3][y_temp]==-1&&board[x_temp+1][y_temp]==black_or_white&&board[x_temp+2][y_temp]==-1)return true;//judge up_downif(y_temp>=2&&y_temp<=BOARDSIZE-3)if(board[x_temp][y_temp-1]==black_or_white&&board[x_temp][y_temp-2]==-1&&board[x_temp][y_temp+1]==black_or_white&&board[x_temp][y_temp+2]==-1)return true;if(y_temp>=2&&y_temp<=BOARDSIZE-4)if(board[x_temp][y_temp-1]==black_or_white&&board[x_temp][y_temp-2]==-1&&board[x_temp][y_temp+1]==-1&&board[x_temp][y_temp+2]==black_or_white&&board[x_temp][y_temp+3]==-1)return true;if(y_temp>=3&&y_temp<=BOARDSIZE-3)if(board[x_temp][y_temp-1]==-1&&board[x_temp][y_temp-2]==black_or_white&&board[x_temp][y_temp-3]==-1&&board[x_temp][y_temp+1]==black_or_white&&board[x_temp][y_temp+2]==-1)return true;//judge LU_RDif(y_temp>=2&&y_temp<=BOARDSIZE-3&&x_temp>=2&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp-1]==black_or_white&&board[x_temp-2][y_temp-2]==-1&&board[x_temp+1][y_temp+1]==black_or_white&&board[x_temp+2][y_temp+2]==-1)return true;if(y_temp>=2&&y_temp<=BOARDSIZE-4&&x_temp>=2&&x_temp<=BOARDSIZE-4)if(board[x_temp-1][y_temp-1]==black_or_white&&board[x_temp-2][y_temp-2]==-1&&board[x_temp+1][y_temp+1]==-1&&board[x_temp+2][y_temp+2]==black_or_white&&board[x_temp+3][y_temp+3]==-1)return true;if(y_temp>=3&&y_temp<=BOARDSIZE-3&&x_temp>=3&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp-1]==-1&&board[x_temp-2][y_temp-2]==black_or_white&&board[x_temp-3][y_temp-3]==-1&&board[x_temp+1][y_temp+1]==black_or_white&&board[x_temp+2][y_temp+2]==-1)return true;//judge LD_RUif(y_temp>=2&&y_temp<=BOARDSIZE-3&&x_temp>=2&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp+1]==black_or_white&&board[x_temp-2][y_temp+2]==-1&&board[x_temp+1][y_temp-1]==black_or_white&&board[x_temp+2][y_temp-2]==-1)return true;if(y_temp>=2&&y_temp<=BOARDSIZE-4&&x_temp>=2&&x_temp<=BOARDSIZE-4)if(board[x_temp-1][y_temp+1]==black_or_white&&board[x_temp-2][y_temp+2]==-1&&board[x_temp+1][y_temp-1]==-1&&board[x_temp+2][y_temp-2]==black_or_white&&board[x_temp+3][y_temp-3]==-1)return true;if(y_temp>=3&&y_temp<=BOARDSIZE-3&&x_temp>=3&&x_temp<=BOARDSIZE-3)if(board[x_temp-1][y_temp+1]==-1&&board[x_temp-2][y_temp+2]==black_or_white&&board[x_temp-3][y_temp+3]==-1&&board[x_temp+1][y_temp-1]==black_or_white&&board[x_temp+2][y_temp-2]==-1)return true;return false;}//判断死连三类型bool si_lian_san(int x,int y,int black_or_white){int num=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge rightfor(i=1;i<4;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp1<=BOARDSIZE-2&&x_temp>=1)if(num==3){if(board[x_temp1+1][y_temp1]==3-black_or_white&&board[x_temp-1][y_temp]==3-black_or_white)return false;else if(board[x_temp1+1][y_temp1]==3-black_or_white&&board[x_temp-1][y_temp]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}//judge leftx_temp1=x_temp;num=0;for(i=1;i<4;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp1>=1&&x_temp<=BOARDSIZE-2)if(num==3){if(board[x_temp1-1][y_temp1]==3-black_or_white&&board[x_temp+1][y_temp]==3-black_or_white)return false;else if(board[x_temp1-1][y_temp1]==3-black_or_white&&board[x_temp+1][y_temp]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}//judge upnum=0;x_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<4;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(y_temp1>=1&&y_temp<=BOARDSIZE-2)if(num==3){if(board[x_temp1][y_temp1-1]==3-black_or_white&&board[x_temp][y_temp+1]==3-black_or_white)return false;else if(board[x_temp1][y_temp1-1]==3-black_or_white&&board[x_temp][y_temp+1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;} //judge downy_temp1=y_temp;num=0;for(i=1;i<4;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(y_temp1<=BOARDSIZE-2&&y_temp>=1)if(num==3){if(board[x_temp1][y_temp1+1]==3-black_or_white&&board[x_temp][y_temp-1]==3-black_or_white)return false;else if(board[x_temp1][y_temp1+1]==3-black_or_white&&board[x_temp][y_temp-1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;} //judge left_upx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<4;i++){x_temp1-=1;y_temp1-=1;if(y_temp1<0 || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp1>=1&&y_temp1>=1&&y_temp<=BOARDSIZE-2&&x_temp<=BOARDSIZE-2)if(num==3){if(board[x_temp1-1][y_temp1-1]==3-black_or_white&&board[x_temp+1][y_temp+1]==3-black_or_white)return false;else if(board[x_temp1-1][y_temp1-1]==3-black_or_white&&board[x_temp+1][y_temp+1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}//judge right_downx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<4;i++){x_temp1+=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp>=1&&y_temp>=1&&y_temp1<=BOARDSIZE-2&&x_temp1<=BOARDSIZE-2)if(num==3){if(board[x_temp1+1][y_temp1+1]==3-black_or_white&&board[x_temp-1][y_temp-1]==3-black_or_white)return false;else if(board[x_temp1+1][y_temp1+1]==3-black_or_white&&board[x_temp-1][y_temp-1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}//judge right_upx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<4;i++){x_temp1+=1;y_temp1-=1;if(y_temp1<0 || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp>=1&&y_temp1>=1&&y_temp<=BOARDSIZE-2&&x_temp1<=BOARDSIZE-2)if(num==3){if(board[x_temp1+1][y_temp1-1]==3-black_or_white&&board[x_temp-1][y_temp+1]==3-black_or_white)return false;else if(board[x_temp1+1][y_temp1-1]==3-black_or_white&&board[x_temp-1][y_temp+1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}//judge left_downx_temp1=x_temp;y_temp1=y_temp;num=0;for(i=1;i<4;i++){x_temp1-=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num++;else if(board[x_temp1][y_temp1]==3-black_or_white)num--;elsebreak;}if(x_temp1>=1&&y_temp>=1&&y_temp1<=BOARDSIZE-2&&x_temp<=BOARDSIZE-2)if(num==3){if(board[x_temp1-1][y_temp1+1]==3-black_or_white&&board[x_temp+1][y_temp-1]==3-black_or_white)return false;else if(board[x_temp1-1][y_temp1+1]==3-black_or_white&&board[x_temp+1][y_temp-1]==-1){if(black_or_white==colour)return true;else return false;}elsereturn true;}int num1=0,num2=0;x_temp1=x_temp;y_temp1=y_temp;//judge rightfor(i=1;i<4;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE-1) break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}x_temp1=x_temp;for(i=1;i<4;i++){x_temp1-=1;if(x_temp1<=0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}if(num1!=3&&num2!=3&&num1+num2==3)return true;//judge upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){y_temp1-=1;if(y_temp1<=0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge downy_temp1=y_temp;for(i=1;i<4;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE-1)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}if(num1!=3&&num2!=3&&num1+num2==3)return true;//judge left_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){x_temp1-=1;y_temp1-=1;if(y_temp1<=0 || x_temp1<=0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge right_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<4;i++){x_temp1+=1;y_temp1+=1;if(y_temp1>=BOARDSIZE-1 || x_temp1>=BOARDSIZE-1)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}if(num1!=3&&num2!=3&&num1+num2==3)return true;//judge right_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){x_temp1+=1;y_temp1-=1;if(y_temp1<=0 || x_temp1>=BOARDSIZE-1)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge left_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<4;i++){x_temp1-=1;y_temp1+=1;if(y_temp1>=BOARDSIZE-1 || x_temp1<=0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}if(num1!=3&&num2!=3&&num1+num2==3)return true;return false;}//判断活连三类型bool huo_lian_san(int x,int y,int black_or_white){int x_temp1=x,y_temp1=y;//left and rightif(x_temp1<BOARDSIZE-1&&x_temp1>=4)if(board[x_temp1+1][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==black_or_white&&board[x_temp1-4][y_temp1]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1)if(board[x_temp1-1][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==black_or_white&&board[x_temp1+4][y_temp1]==-1)return true;//up and downif(y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1][y_temp1+1]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==black_or_white&&board[x_temp1][y_temp1-4]==-1)return true;if(y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1][y_temp1-1]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==black_or_white&&board[x_temp1][y_temp1+4]==-1)return true;//UL and DRif(x_temp1<BOARDSIZE-1&&x_temp1>=4&&y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1+1][y_temp1+1]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==black_or_white&&board[x_temp1-4][y_temp1-4]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1&&y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1-1][y_temp1-1]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==black_or_white&&board[x_temp1+4][y_temp1+4]==-1)return true;//UR and DLif(x_temp1<BOARDSIZE-1&&x_temp1>=4&&y_temp1<BOARDSIZE-4&&y_temp1>=1)if(board[x_temp1+1][y_temp1-1]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==black_or_white&&board[x_temp1-4][y_temp1+4]==-1)return true;if(x_temp1<BOARDSIZE-4&&x_temp1>=1&&y_temp1<BOARDSIZE-1&&y_temp1>=4)if(board[x_temp1-1][y_temp1+1]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==black_or_white&&board[x_temp1+4][y_temp1-4]==-1)return true;return false;}bool duan_lian_san(int x,int y,int black_or_white){int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//left and rightif(x_temp1<BOARDSIZE-2&&x_temp1>=3)if(board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==black_or_white&&board[x_temp1-3][y_temp1]==-1&&board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==-1)return true;if(x_temp1<BOARDSIZE-3&&x_temp1>=2)if(board[x_temp1+1][y_temp1]==black_or_white&&board[x_temp1+2][y_temp1]==black_or_white&&board[x_temp1+3][y_temp1]==-1&&board[x_temp1-1][y_temp1]==black_or_white&&board[x_temp1-2][y_temp1]==-1)return true;//up and downif(y_temp1<BOARDSIZE-2&&y_temp1>=3)if(board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==black_or_white&&board[x_temp1][y_temp1-3]==-1&&board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==-1)return true;if(y_temp1<BOARDSIZE-3&&y_temp1>=2)if(board[x_temp1][y_temp1+1]==black_or_white&&board[x_temp1][y_temp1+2]==black_or_white&&board[x_temp1][y_temp1+3]==-1&&board[x_temp1][y_temp1-1]==black_or_white&&board[x_temp1][y_temp1-2]==-1)return true;//UL and RDif(x_temp1<BOARDSIZE-2&&x_temp1>=3&&y_temp1<BOARDSIZE-2&&y_temp1>=3)if(board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==black_or_white&&board[x_temp1-3][y_temp1-3]==-1&&board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==-1)return true;if(x_temp1<BOARDSIZE-3&&x_temp1>=2&&y_temp1<BOARDSIZE-3&&y_temp1>=2)if(board[x_temp1+1][y_temp1+1]==black_or_white&&board[x_temp1+2][y_temp1+2]==black_or_white&&board[x_temp1+3][y_temp1+3]==-1&&board[x_temp1-1][y_temp1-1]==black_or_white&&board[x_temp1-2][y_temp1-2]==-1)return true;//UR and LDif(x_temp1<BOARDSIZE-2&&x_temp1>=3&&y_temp1<BOARDSIZE-3&&y_temp1>=2)if(board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==black_or_white&&board[x_temp1-3][y_temp1+3]==-1&&board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==-1)return true;if(x_temp1<BOARDSIZE-3&&x_temp1>=2&&y_temp1<BOARDSIZE-2&&y_temp1>=3)if(board[x_temp1+1][y_temp1-1]==black_or_white&&board[x_temp1+2][y_temp1-2]==black_or_white&&board[x_temp1+3][y_temp1-3]==-1&&board[x_temp1-1][y_temp1+1]==black_or_white&&board[x_temp1-2][y_temp1+2]==-1)return true;return false;}bool lian_si(int x,int y,int black_or_white){int num1=0,max_temp=0,num2=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge rightfor(i=1;i<5;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}if(num1==4)return true;//judge leftx_temp1=x_temp;for(i=1;i<5;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num2==4)return true;//judge upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<5;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}if(num1==4)return true;//judge downy_temp1=y_temp;for(i=1;i<5;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num2==4)return true;//judge left_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<5;i++){x_temp1-=1;y_temp1-=1;if(y_temp1<0 || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}if(num1==4)return true;//judge right_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<5;i++){x_temp1+=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num2==4)return true;//judge right_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<5;i++){x_temp1+=1;y_temp1-=1;if(y_temp1<0 || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;else if(board[x_temp1][y_temp1]==3-black_or_white)num1--;elsebreak;}if(num1==4)return true;//judge left_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<5;i++){x_temp1-=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;else if(board[x_temp1][y_temp1]==3-black_or_white)num2--;elsebreak;}if(num2==4)return true;return false;}//判断连断四类型bool lian_duan_si(int x,int y,int black_or_white){int x_temp=x,y_temp=y;//judeg leftif(x_temp<=BOARDSIZE-5&&x_temp>=0)if(board[x_temp+1][y_temp]==-1&&board[x_temp+2][y_temp]==black_or_white&&board[x_temp+3][y_temp]==black_or_white&&board[x_temp+4][y_temp]==black_or_white)return true;//judge rightif(x_temp<=BOARDSIZE-1&&x_temp>=4)if(board[x_temp-1][y_temp]==-1&&board[x_temp-2][y_temp]==black_or_white&&board[x_temp-3][y_temp]==black_or_white&&board[x_temp-4][y_temp]==black_or_white)return true;//judeg upif(y_temp<=BOARDSIZE-5&&y_temp>=0)if(board[x_temp][y_temp+1]==-1&&board[x_temp][y_temp+2]==black_or_white&&board[x_temp][y_temp+3]==black_or_white&&board[x_temp][y_temp+4]==black_or_white)return true;//judge downif(y_temp<=BOARDSIZE-1&&y_temp>=4)if(board[x_temp][y_temp-1]==-1&&board[x_temp][y_temp-2]==black_or_white&&board[x_temp][y_temp-3]==black_or_white&&board[x_temp][y_temp-4]==black_or_white)return true;//judge U_Lif(x_temp<=BOARDSIZE-5&&x_temp>=0&&y_temp<=BOARDSIZE-5&&y_temp>=0)if(board[x_temp+1][y_temp+1]==-1&&board[x_temp+2][y_temp+2]==black_or_white&&board[x_temp+3][y_temp+3]==black_or_white&&board[x_temp+4][y_temp+4]==black_or_white)return true;//judge D_Lif(x_temp<=BOARDSIZE-5&&x_temp>=0&&y_temp<=BOARDSIZE-1&&y_temp>=4)if(board[x_temp+1][y_temp-1]==-1&&board[x_temp+2][y_temp-2]==black_or_white&&board[x_temp+3][y_temp-3]==black_or_white&&board[x_temp+4][y_temp-4]==black_or_white)return true;//judge U_Rif(x_temp<=BOARDSIZE-1&&x_temp>=4&&y_temp<=BOARDSIZE-5&&y_temp>=0)if(board[x_temp-1][y_temp+1]==-1&&board[x_temp-2][y_temp+2]==black_or_white&&board[x_temp-3][y_temp+3]==black_or_white&&board[x_temp-4][y_temp+4]==black_or_white)return true;//judge D_Rif(x_temp<=BOARDSIZE-1&&x_temp>=4&&y_temp<=BOARDSIZE-1&&y_temp>=4)if(board[x_temp-1][y_temp-1]==-1&&board[x_temp-2][y_temp-2]==black_or_white&&board[x_temp-3][y_temp-3]==black_or_white&&board[x_temp-4][y_temp-4]==black_or_white)return true;return false;}bool duan_lian_si(int x,int y,int black_or_white){int num1=0,max_temp=0,num2=0,i;int x_temp=x,y_temp=y;int x_temp1=x_temp,y_temp1=y_temp;//judge rightfor(i=1;i<4;i++){x_temp1+=1;if(x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge leftx_temp1=x_temp;for(i=1;i<4;i++){x_temp1-=1;if(x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}max_temp=num1+num2;if(max_temp>=4)return true;//judge upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){y_temp1-=1;if(y_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge downy_temp1=y_temp;for(i=1;i<4;i++){y_temp1+=1;if(y_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}max_temp=num1+num2;if(max_temp>=4)return true;//judge left_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){x_temp1-=1;y_temp1-=1;if(y_temp1<0 || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge right_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<4;i++){x_temp1+=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}max_temp=num1+num2;if(max_temp>=4)return true;//judge right_upx_temp1=x_temp;y_temp1=y_temp;num1=0;num2=0;for(i=1;i<4;i++){x_temp1+=1;y_temp1-=1;if(y_temp1<0 || x_temp1>=BOARDSIZE)break;if(board[x_temp1][y_temp1]==black_or_white)num1++;elsebreak;}//judge left_downx_temp1=x_temp;y_temp1=y_temp;for(i=1;i<4;i++){x_temp1-=1;y_temp1+=1;if(y_temp1>=BOARDSIZE || x_temp1<0)break;if(board[x_temp1][y_temp1]==black_or_white)num2++;elsebreak;}max_temp=num1+num2;if(max_temp>=4)return true;return false;}bool zhouwei3(int x,int y,int black_or_white){int x_temp=x,y_temp=y,num1=0,num2=0;if(x_temp>=1){if(board[x_temp-1][y_temp]==black_or_white)num1++;else if(board[x_temp-1][y_temp]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp]==black_or_white)num1++;else if(board[x_temp+1][y_temp]==3-black_or_white)num2++;}if(y_temp>=1){if(board[x_temp][y_temp-1]==black_or_white)num1++;else if(board[x_temp][y_temp-1]==3-black_or_white)num2++;}if(y_temp<BOARDSIZE-1){if(board[x_temp][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp>=1){if(board[x_temp-1][y_temp-1]==black_or_white)num1++;else if(board[x_temp-1][y_temp-1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp>=1){if(board[x_temp+1][y_temp-1]==black_or_white)num1++;else if(board[x_temp+1][y_temp-1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp<BOARDSIZE-1){if(board[x_temp-1][y_temp+1]==black_or_white)num1++;else if(board[x_temp-1][y_temp+1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(num1-num2>=3)return true;return false;}bool zhouwei2(int x,int y,int black_or_white){int x_temp=x,y_temp=y,num1=0,num2=0;if(x_temp>=1){if(board[x_temp-1][y_temp]==black_or_white)num1++;else if(board[x_temp-1][y_temp]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp]==black_or_white)num1++;else if(board[x_temp+1][y_temp]==3-black_or_white)num2++;}if(y_temp>=1){if(board[x_temp][y_temp-1]==black_or_white)num1++;else if(board[x_temp][y_temp-1]==3-black_or_white)num2++;}if(y_temp<BOARDSIZE-1){if(board[x_temp][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp>=1){if(board[x_temp-1][y_temp-1]==black_or_white)num1++;else if(board[x_temp-1][y_temp-1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp>=1){if(board[x_temp+1][y_temp-1]==black_or_white)num1++;else if(board[x_temp+1][y_temp-1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp<BOARDSIZE-1){if(board[x_temp-1][y_temp+1]==black_or_white)num1++;else if(board[x_temp-1][y_temp+1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(num1-num2>=2)return true;return false;}bool zhouwei1(int x,int y,int black_or_white){int x_temp=x,y_temp=y,num1=0,num2=0;if(x_temp>=1){if(board[x_temp-1][y_temp]==black_or_white)num1++;else if(board[x_temp-1][y_temp]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp]==black_or_white)num1++;else if(board[x_temp+1][y_temp]==3-black_or_white)num2++;}if(y_temp>=1){if(board[x_temp][y_temp-1]==black_or_white)num1++;else if(board[x_temp][y_temp-1]==3-black_or_white)num2++;}if(y_temp<BOARDSIZE-1){if(board[x_temp][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp>=1){if(board[x_temp-1][y_temp-1]==black_or_white)num1++;else if(board[x_temp-1][y_temp-1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp>=1){if(board[x_temp+1][y_temp-1]==black_or_white)num1++;else if(board[x_temp+1][y_temp-1]==3-black_or_white)num2++;}if(x_temp>=1&&y_temp<BOARDSIZE-1){if(board[x_temp-1][y_temp+1]==black_or_white)num1++;else if(board[x_temp-1][y_temp+1]==3-black_or_white)num2++;}if(x_temp<BOARDSIZE-1&&y_temp<BOARDSIZE-1){if(board[x_temp+1][y_temp+1]==black_or_white)num1++;else if(board[x_temp][y_temp+1]==3-black_or_white)num2++;}if(num1-num2>=1)return true;return false;}void computerDo(int flag){int max_black,temp1=100,max_white,min=-100,temp=0,max=0,max_temp,level,x[] ={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},y[]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},i,j,m,n;srand(time(NULL));for(i = 0; i < BOARDSIZE; i++){for(j = 0; j < BOARDSIZE; j++){if(board[i][j]==-1){//算法判断是否下子if(lian_si(i,j,colour)||duan_lian_si(i,j,colour)){level=37;x[level]=i;y[level]=j;}else{if(lian_si(i,j,3-colour)||duan_lian_si(i,j,3-colour)){level=36;x[level]=i;y[level]=j;}else{if(si_si(i,j,colour)||si_san(i,j,colour)){ level=35;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)&&huo_lian_san(i,j,colour)){level=34;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,colour)&&huo_duan_er(i,j,colour)||huo_lian_san(i,j,colour)&&huo_er(i,j,colour)){level=33;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,colour)&&zhouwei3(i,j,colour)){level=32;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,colour)&&zhouwei2(i,j,colour)){level=31;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,colour)&&zhouwei1(i,j,colour)){level=30;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,colour)||duan_lian_san(i,j,colour)){level=29;x[level]=i;y[level]=j;}else{if(si_si(i,j,3-colour)||si_san(i,j,3-colour)){level=28;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)&&huo_er(i,j,colour)||huo_lian_san(i,j,3-colour)&&huo_duan_er(i,j,colour)){level=27;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)&&zhouwei3(i,j,3-colour)){level=26;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)&&zhouwei2(i,j,3-colour)){level=25;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)&&zhouwei1(i,j,3-colour)){level=24;x[level]=i;y[level]=j;}else{if(huo_lian_san(i,j,3-colour)||duan_lian_san(i,j,3-colour)){level=23;x[level]=i;y[level]=j;}else{if(lian_duan_si(i,j,colour)&&huo_er(i,j,colour)||lian_duan_si(i,j,colour)&&huo_lian_san(i,j,colour)||lian_duan_si(i,j,colour)&&huo_duan_er(i,j,colour)||si_lian_san(i,j,colour)&&huo_er(i,j,colour)||si_lian_san(i,j,colour)&&huo_lian_san(i,j,colour)||si_lian_san(i,j,colour)&&huo_duan_er(i,j,colour)){level=22;x[level]=i;y[level]=j;}else{if(san_san(i,j,colour)){level=21;x[level]=i;y[level]=j;}else{if((huo_er(i,j,colour)&&san_san(i,j,3-colour))||(huo_duan_er(i,j,colour)&&san_san(i,j,3-colour))){level=20;x[level]=i;y[level]=j;}else{if(san_san(i,j,3-colour)){level=19;x[level]=i;y[level]=j;}else{if(lian_duan_si(i,j,3-colour)&&huo_er(i,j,3-colour)||lian_duan_si(i,j,3-colour)&&huo_lian_san(i,j,3-colour)||lian_duan_si(i,j,3-colour)&&huo_duan_er(i,j,3-colour)||si_lian_san(i,j,3-colour)&&huo_er(i,j,3-colour)||si_lian_san(i,j,3-colour)&&huo_lian_san(i,j,3-colour)||si_lian_san(i,j,3-colour)&&huo_duan_er(i,j,3-colour)){level=18;x[level]=i;y[level]=j;}else{if(si_lian_san(i,j,colour)||lian_duan_si(i,j,colour)){level=17;x[level]=i;y[level]=j;}else{if(huo_er(i,j,colour)&&shi_zi_er(i,j,colour)){level=16;x[level]=i;y[level]=j;}else{if((huo_er(i,j,colour)&&huo_er(i,j,3-colour))||(huo_duan_er(i,j,colour)&&huo_er(i,j,3-colour))||(huo_duan_er(i,j,colour)&&huo_duan_er(i,j,3-colour))||(huo_er(i,j,colour)&&huo_duan_er(i,j,3-colour))){level=15;x[level]=i;y[level]=j;}else{if((huo_er(i,j,colour)&&si_er(i,j,colour))||(huo_er(i,j,colour)&&si_er(i,j,3-colour))){level=14;x[level]=i;y[level]=j;}else{if(huo_er(i,j,colour)||huo_duan_er(i,j,colour)){level=13;x[level]=i;y[level]=j;}else{if(huo_er(i,j,colour)&&zhouwei3(i,j,colour)||huo_duan_er(i,j,colour)&&zhouwei3(i,j,colour)){level=12;x[level]=i;y[level]=j;}else{if(huo_er(i,j,colour)&&zhouwei2(i,j,colour)||huo_duan_er(i,j,colour)&&zhouwei2(i,j,colour)){level=11;x[level]=i;y[level]=j;}else{if(huo_er(i,j,colour)&&zhouwei1(i,j,colour)||huo_duan_er(i,j,colour)&&zhouwei1(i,j,colour)){level=10;x[level]=i;y[level]=j;}else{if(lian_duan_si(i,j,3-colour)){level=9;x[level]=i;y[level]=j;}else{if(huo_er(i,j,3-colour)&&shi_zi_er(i,j,3-colour)){level=8;x[level]=i;y[level]=j;}else{if(huo_er(i,j,3-colour)&&zhouwei3(i,j,3-colour)||huo_duan_er(i,j,3-colour)&&zhouwei3(i,j,3-colour)){level=7;x[level]=i;y[level]=j;}else{if(huo_er(i,j,3-colour)&&zhouwei2(i,j,3-colour)||huo_duan_er(i,j,3-colour)&&zhouwei2(i,j,3-colour)){level=6;x[level]=i;y[level]=j;}else{if(huo_er(i,j,3-colour)&&zhouwei1(i,j,3-colour)||huo_duan_er(i,j,3-colour)&&zhouwei1(i,j,3-colour)){level=5;x[level]=i;y[level]=j;}else{if(huo_er(i,j,3-colour)||huo_duan_er(i,j,3-colour)){level=4;x[level]=i;y[level]=j;}else{if(xie_zi_er(i,j,colour)||shi_zi_er(i,j,colour)){level=3;x[level]=i;y[level]=j;}else{if(xie_zi_er(i,j,3-colour)||shi_zi_er(i,j,3-colour)){level=2;x[level]=i;y[level]=j;}else{max_white=checkMax(i,j,colour);//判断白子的最大值max_black=checkMax(i,j,3-colour);//判断黑子的最大值if(max_white>max_black)max_temp=max_white;elsemax_temp=max_black;if(max_temp>max&&count==0){max=max_temp;level=1;x[level]=i;y[level]=j;}else if(count==1){for(m=1;m<BOARDSIZE-1;m++)for(n=1;n<BOARDSIZE-1;n++)if(board[m][n]==colour){level=1;if(board[m+1][n-1]==-1){x[level]=m+1;y[level]=n-1;}else if(board[m-1][n+1]==-1){x[level]=m-1;y[level]=n+1;}}}else if(count>=2){do{m=rand()%15;n=rand()%15;level=1;x[level]=m;y[level]=n;}while(board[m][n]!=-1);}}}}}}}}}}}}}}}}}}}}}}}}}}} }}} }}}}} }}}}}if(flag==3){for(i=37;i>=1;i--){if(x[i]!=-1){temp3=i;return;}}}if(flag==2){for(i=37;i>=1;i--){if(x[i]!=-1){board[x[i]][y[i]]=colour;computerDo(flag+1);board[x[i]][y[i]]=-1;temp2=i;return;}}}if(flag==1){for(i=37;i>=1;i--){if(x[i]!=-1){board[x[i]][y[i]]=3-colour;computerDo(flag+1);board[x[i]][y[i]]=-1;temp1=i;return;}}}else if(flag==0){for(i=37;i>=2;i--){if(x[i]!=-1){board[x[i]][y[i]]=colour;computerDo(flag+1);board[x[i]][y[i]]=-1;if(i==37){X=x[i];Y=y[i];//cout<<" 1"<<i<<endl;return;}else if(i==36||i==18||i==17){X=x[i];Y=y[i];//cout<<" 2"<<i<<endl;return;}else if((i==35||i==34||i==33||i==32||i==31||i==30||i==29)&&temp1!=36&&temp1!=18&&temp1!=17){X=x[i];Y=y[i];//cout<<" 3"<<i<<endl;return;}else if(i==34||i==28||i==27||i==26||i==25||i==24||i==23){X=x[i];Y=y[i];//cout<<" 4"<<i<<endl;return;}else if((i==21||i==22)&&!(temp1==36||temp1==34||temp1==28||temp1==27||temp1==26||temp1==25||temp1==24||temp1==23)){X=x[i];Y=y[i];//cout<<" 5"<<i<<endl;return;}else if((i==20||i==19)&&!(temp1==21||temp1==22)){X=x[i];Y=y[i];//cout<<" 6"<<i<<endl;return;}else{if(temp2==37){X=x[i];Y=y[i];//cout<<" 7"<<i<<endl;return;}else if(temp2==36||temp2==18||temp2==17){X=x[i];Y=y[i];//cout<<" 8"<<i<<endl;return;}else if((temp2==35||temp2==34||temp2==33||temp2==32||temp2==31||temp2==30||temp2==29)&&temp3!=36&&temp3!=18&&temp3!=17){X=x[i];Y=y[i];//cout<<" 9"<<i<<endl;return;}else if(temp2==34||temp2==28||temp2==27||temp2==26||temp2==25||temp2==24||temp2==23){X=x[i];Y=y[i];//cout<<" 10"<<i<<endl;return;}else if((temp2==21||temp2==22)&&!(temp3==36||temp3==34||temp3==28||temp3==27||temp3==26||temp3==25||temp3==24||temp3==23)){X=x[i];Y=y[i];//cout<<" 11"<<i<<endl;return;}else if((temp2==20||temp2==19)&&!(temp3==21||temp3==22)){X=x[i];Y=y[i];//cout<<" 12"<<i<<endl;return;}elsecontinue;}}}for(i=17;i>=1;i--){if(x[i]!=-1){X=x[i];Y=y[i];break;}//cout<<x[4]<<' '<<y[4]<<' '<<endl;}}}int main() { char command[10]; //用于保存命令的字符串 for (int i = 0; i < BOARDSIZE; i++) for (int j = 0; j < BOARDSIZE; j++) board[i][j] = -1; //棋盘初始化 cin >> command; if(strcmp(command, "[START]") != 0)//读入第一条命令{return 0; //如果不是[START]则停止程序 }cin >> colour; //读入己方颜色 while (true) { int rival_x, rival_y; //用于保存对手上一步落子点 cin >> command; //读入命令 if (strcmp(command, "[PUT]") != 0)break; //如果不是[PUT]则停止程序 cin >> rival_x >> rival_y; //读入对手上一步落子点 if(colour == 1 && rival_x == -1 && rival_y == -1) //如果己方执黑且是第一步,则占据棋盘中心位置 { board[BOARDSIZE / 2][BOARDSIZE / 2] = colour; //更新棋盘信息cout << BOARDSIZE / 2 << ' ' << BOARDSIZE / 2 << endl; //输出cout << flush; //刷新缓冲区}else {board[rival_x][rival_y] = 3 - colour; //更新棋盘信息 do{ computerDo(0);count++;if (board[X][Y] == -1) //如果该位置为空则占据该位置 {board[X][Y] = colour; //更新棋盘信息 cout << X << ' ' << Y << endl; //输出 cout << flush; //刷新缓冲区break; //结束循环 }}while (true); //循环直至随机得到一个空位置 }}return 0; }