0

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?

2

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.

6
  • It is there, same like this. But still, it shows the same error – Bhakti Khakkar Apr 2 '17 at 15:10
  • The program is not producing the expected output in log.txt. It would be pointless to speculate on the dozens of ways that could happen. You'd have to include a pastebin link to your code, or edit your code into the question. – DinoCoderSaurus Apr 2 '17 at 16:16
  • What should I do then? Plz help. – Bhakti Khakkar Apr 4 '17 at 15:47
  • Include a pastebin link to your fifteen.c source or edit it into the question. – DinoCoderSaurus Apr 4 '17 at 20:15
  • What's pastebin link? is it a header? plz explain and help me edit my code – Bhakti Khakkar Apr 5 '17 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .