So after weeks of struggle, i'm happy to say i finally completed this pset last night. the WON function took me a while as i couldn't figure out how to account for the final tile as blank, but somehow came to the conclusion that using an OR statement gets me there. Even though the code works and passes the check, i questioned whether my if statement was flawless or not, i couldn't think of any situations where it would fail, but maybe another set of eyes could see something i do not? Will my WON function always work? thank you
bool won(void)
{
int x = 1;
// go through each tile from 1 to d-1//
for (int i = 0; i < d; i++)
{
for (int j = 0; j < d; j++)
{
if(board[i][j] == x ||board[i][j] == 0 )
{
x++;
}
else{
return false;}
}
}
return true;
}
//end of game//