bool won(void)
{
int counter = 1;
for (int i = 0; i < d; i++)
{
for (int j = 0; j< d; j++)
{
while (board[i][j] != board[d-1][d-1] && counter != d*d-1)
{
if (board [i][j] == counter && counter < (d * d))
{
counter++;
}
}
}
}
return false;
}
I have tried placing a "return true;" statement in the above code in several places using different condition methods to no success. When I check with ./fifteen 3 < ~cs50/pset3/3x3.txt it either immediately returns true after the board is drawn, or the game finishes and returns false, or the game gets stuck immediately after drawing the board. Suggestions?