The project is in c++Builder 6;

The function that is supposed to return 1 if x wins and 2 if o wins is :

//---------------------------------------------------------------

int Game:: PlayerWins(int ct[10]){ //ct defined globally int i,j; for(i=0;i<n;i++) for(j=0;j<n;j++){ if(T[i][j]==T[i][j+1]==1) ct[0]++; //1 aka x else ct[0]=0; if(T[i][j]==T[i][j+1]==2) ct[1]++; //2 else ct[1]=0; if((i==j)&&(T[i][j]==T[i+1][j+1]==1)) ct[2]++; //1 else ct[2]=0; if((i==j)&&(T[i][j]==T[i+1][j+1]==2)) ct[3]++; //2 else ct[3]=0; } for(j=0;j<n;j++) for(i=0;i<n;i++){ if(T[i][j]==T[i+1][j]==1) ct[4]++; //1 else ct[4]=0; if(T[i][j]==T[i+1][j]==2) ct[5]++; //2 else ct[5]=0; if(T[i][4-i]==T[i+1][4-i-1]==1) ct[6]++; //1 else ct[6]=0; if(T[i][4-i]==T[i+1][4-i-1]==1) ct[7]++; //2 else ct[7]=0; } if ((ct[0]==4)||(ct[2]==4)||(ct[4]==4)||(ct[6]==4)) return 1; if ((ct[1]==4)||(ct[3]==4)||(ct[5]==4)||(ct[7]==4)) return 2; }

//---------------------------------------------------------------

The problem is that only the first row seems to work ; any other possible winning group(on a column, or diagonally ) is not "seen" by the function.

I would be very grateful if anyone can spot the mistakes i've made.Thank you !

This post has been edited by **AvL**: 06 January 2011 - 11:05 AM