I'm developing the rooster / old game and in this game I have to check every new move or iteration if there is any winner. I started by trying to do this for a static array predefined by myself and also started by doing the check first by deleting the two possible diagonals. The code is as follows
UPDATE
int main()
{
int VEC[3][3] = {
{1,1,1},
{0,1,0},
{1,0,1}
};
int m = 3;
int n = 3;
int i = 0,j = 0,count = 1,total = 0;
for(i = 0; i < 3; i++)
{
for(j = 0; j < 3; j++)
{
if(VEC[i][j] == VEC[i][j+1])
{
count++;
if(count == 3)
{
printf("GANHOU!\n");
break;
}
}
else
{
count = 0;
break;
}
}
}
}
In this case I've submitted it tells me that there is a winner and there really is a winning key in the last row of the array. But I have some doubts about this code. Firstly because I think in all the lines I left out of the array by being checking the j + 1 position. And I do not know to what extent this is quite wrong or not. Then I tried to control this situation by adding i