My won() function works properly when the board dimensions are 3 x 3. However, it doesn't work properly when the board dimensions are 4 x 4. What could possibly be wrong?
for (int i = 0; i < d; i++)
{
for (int j = 0; j < d; j++)
{
if ((i==(d-1)) && (j==(d-1)))
{
if (board[i][j] != 0)
return false;
}
else if (j > 0)
{
if (board[i][j] < board[i][j-1])
return false;
}
else
{
if (board[i][j] < board[i-1][d-1])
return false;
}
}
}
return true;