My code runs perfectly. but check50 says....
:( init initializes 3x3 board correctly
\ expected file to be of length 18, not 0
:( init initializes 4x4 board correctly
\ expected file to be of length 38, not 0
where am i going wrong?
Sounds like you lost the logging section of the supplied code. It was in the distro fifteen.c
at line 80 after the call to draw()
:
// log the current state of the board (for testing)
for (int i = 0; i < d; i++)
{
for (int j = 0; j < d; j++)
{
fprintf(file, "%i", board[i][j]);
if (j < d - 1)
{
fprintf(file, "|");
}
}
fprintf(file, "\n");
}
fflush(file);
That is how check50 verifies the result.