请问还有更好的五子棋判断方法吗
int CMywuziqi1::Judgment(){
UINT count1=0,count2=0;
for (int i=0;i<15;i++)
{ if(count1>=5||count2>=5)
break;
for (int j=0;j<15;j++)
{
if(Board[i][j]==1)
{ count1++;count2=0;}
if(Board[i][j]==2)
{ count2++;count1=0;}
if(count1>=5||count2>=5)
break;
if(Board[i][j]==0)
{count2=0;count1=0;}}
}
/////////////////////////
if(count1<5&&count2<5)
{ count1=0;count2=0;
for (int j=0;j<15;j++)
{ if(count1>=5||count2>=5)break;
for (int i=0;i<15;i++)
{
if(Board[i][j]==1)
{
count1++;count2=0;
}
if(Board[i][j]==2)
{
count2++;count1=0;
}
if(count1>=5||count2>=5)
break;
if(Board[i][j]==0)
{
count2=0;count1=0;
}}}}
////////////////////////////////
if(count1<5&&count2<5)
{count1=0;count2=0;
for(int i=4;i<15;i++)
{if(count1>=5||count2>=5)break;
for(int j=0,k=i;k>=0,j<=i;j++,k--)
{
if(Board[j][k]==1)
{
count1++;
count2=0;
}
if(Board[j][k]==2)
{
count2++;
count1=0;
}
if(count1>=5||count2>=5)
break;
if(Board[j][k]==0)
{
count2=0;
count1=0;
}}}}
///////////////////////////////
if(count1<5&&count2<5)
{count1=0;count2=0;
for(int i=0;i<15;i++)
{if(count1>=5||count2>=5) break;
for(int j=i,k=14;j<15;j++,k--)
{
if(Board[j][k]==1)
{ count1++;count2=0;}
if(Board[j][k]==2)
{ count2++;count1=0;}
if(count1>=5||count2>=5)
break;
if(Board[j][k]==0)
{count2=0;count1=0;
}}}}
///////////////////////////////
if(count1<5&&count2<5)
{count1=0;count2=0;
for(int i=10;i>=0;i--)
{if(count1>=5||count2>=5)
break;
for(int j=0,k=i;j<15,k<15;j++,k++)
{
if(Board[k][j]==1)
{
count1++;count2=0;
}
if(Board[k][j]==2)
{
count2++;count1=0;
}
if(count1>=5||count2>=5)
break;
if(Board[k][j]==0)
{
count2=0;count1=0;
}}}}
//////////////////////////
if(count1<5&&count2<5)
{count1=0;count2=0;
for(int i=0;i<15;i++)
{if(count1>=5||count2>=5)
break;
for(int k=0,j=i;j<15;j++,k++)
{
if(Board[k][j]==1)
{
count1++;count2=0;
}
if(Board[k][j]==2)
{
count2++;count1=0;
}
if(count1>=5||count2>=5)
break;
if(Board[k][j]==0)
{
count2=0;count1=0;
}}}}
if(count1>=5)
return 1;
if(count2>=5)
return 2;
if(count1<5&&count2<5)
return 0;
}