|
@@ -0,0 +1,171 @@
|
|
|
+#include <iostream>
|
|
|
+#include <math.h>
|
|
|
+using namespace std;
|
|
|
+int say(char l[255])
|
|
|
+{
|
|
|
+ cout<<"0123456789012345"<<endl;
|
|
|
+ for (int i=0;i<211;i=i+15)
|
|
|
+ {
|
|
|
+ cout<<(i/15+1)%10;
|
|
|
+ for (int j=i+1;j<i+16;j++)
|
|
|
+ {
|
|
|
+ cout<<l[j];
|
|
|
+ }
|
|
|
+ cout<<endl;
|
|
|
+ }
|
|
|
+}
|
|
|
+int judge(char a[225],int k,int b,char c)
|
|
|
+{
|
|
|
+ if (a[k+1*b]==c&&a[k+2*b]==c&&a[k+3*b]==c&&a[k+4*b]==c)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ cout<<a[k]<<' '<<k<<' '<<b<<' '<<c<<endl;
|
|
|
+ }
|
|
|
+}
|
|
|
+int main () {
|
|
|
+ char a[255];
|
|
|
+ char c;
|
|
|
+ int x,y,k,m,n;
|
|
|
+ m=0;
|
|
|
+ for (int i = 0; i < 226; i++)
|
|
|
+ {
|
|
|
+ a[i]=' ';
|
|
|
+ }
|
|
|
+ while (m==0)
|
|
|
+ {
|
|
|
+ cout<<"blck:";
|
|
|
+ n=0;
|
|
|
+ while(n==0)
|
|
|
+ {
|
|
|
+ cin>>x>>y;
|
|
|
+ cout<<endl;
|
|
|
+ k=(y-1)*15+x;
|
|
|
+ if (a[k]==' ')
|
|
|
+ {
|
|
|
+ a[k]='X';
|
|
|
+ n=1;
|
|
|
+ }
|
|
|
+ else cout<<"nope"<<endl;
|
|
|
+ }
|
|
|
+ say(a);
|
|
|
+ c='X';
|
|
|
+ for (int i=5; i<12; i++)
|
|
|
+ {
|
|
|
+ for(int j=0 ; j<15; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,1,c)==1||judge(a,k,-1,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"black win!1"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i=1; i<16; i++)
|
|
|
+ {
|
|
|
+ for(int j=4 ; j<11; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,15,c)==1||judge(a,k,-15,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"black win!2"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i=5; i<12; i++)
|
|
|
+ {
|
|
|
+ for(int j=4 ; j<11; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,14,c)==1||judge(a,k,-14,c)==1||judge(a,k,16,c)==1||judge(a,k,-16,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"black win!3"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (m==1)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ cout<<"white:";
|
|
|
+ n=0;
|
|
|
+ while(n==0)
|
|
|
+ {
|
|
|
+ cin>>x>>y;
|
|
|
+ cout<<endl;
|
|
|
+ k=(y-1)*15+x;
|
|
|
+ if (a[k]==' ')
|
|
|
+ {
|
|
|
+ a[k]='O';
|
|
|
+ n=1;
|
|
|
+ }
|
|
|
+ else cout<<"nope"<<endl;
|
|
|
+ }
|
|
|
+ say(a);
|
|
|
+ c='O';
|
|
|
+ for (int i=5; i<12; i++)
|
|
|
+ {
|
|
|
+ for(int j=0 ; j<15; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,1,c)==1||judge(a,k,-1,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"white win!1"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i=1; i<16; i++)
|
|
|
+ {
|
|
|
+ for(int j=4 ; j<11; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,15,c)==1||judge(a,k,-15,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"white win!2"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i=5; i<12; i++)
|
|
|
+ {
|
|
|
+ for(int j=4 ; j<11; j++)
|
|
|
+ {
|
|
|
+ k=j*15+i;
|
|
|
+ if(a[k]==c)
|
|
|
+ {
|
|
|
+ if(judge(a,k,14,c)==1||judge(a,k,-14,c)==1||judge(a,k,16,c)==1||judge(a,k,-16,c)==1)
|
|
|
+ {
|
|
|
+ cout<<"white win!3"<<endl;
|
|
|
+ m=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ system("pause");
|
|
|
+ return 0;
|
|
|
+}
|