# The won function in Pset3 fifteen works, but check50 gives me an error for it in the 3x3 table

So this is my code:

``````bool won(void)
{
// check number
int number = 1;

for(int row = 0; row < d; row++)
{
for(int column = 0; column < d; column++)
{
if(number == (d * d) - 1)
{
return true;
}
if(board[row][column] == number)
{
number++;
}
else
{
number = 1;
return false;
}
}
}

return false;
}
``````

When I play the game, and beat it, the function works, check50 gives me a thumbs up for the 4x4, but for the 3x3 it doesn't, where am I going wrong?

Interesting logic error. This could fail on any size board. Let's say that the last row on your 3x3 is `7 0 8` and that the rest of the board is in a winning condition. Here's what is happening. The code checks that 7 is in the right position and increments `number`. On the next pass through the loop, the first thing it checks is if number == d*d-1. Since it is, it reports a win. This can occur if the board is correct, or if the last two tiles are reversed.