0

i have spend some time in CS50 Pset3 fifteen problem set, so far everything works well, however the precise checks of the character on the board is so irritating but i can't seems to find out why is this happening...

This is the error below on the linux console.

:) fifteen.c exists

:) fifteen.c compiles

:( init initializes 3x3 board correctly

\ expected file to be of length 18, not 27

:( init initializes 4x4 board correctly

\ expected file to be of length 38, not 48

This link below is my pset3 fifteen code.

Pset3_fifteen.c

Eg. when ./fifteen 3 runs

 8| 7| 6
 5| 4| 3
 2| 1| _
Tile to move: 

Eg. when ./fifteen 4 runs

15|14|13|12
11|10| 9| 8
 7| 6| 5| 4
 3| 1| 2| _
Tile to move: 

Help plox :(

1

You have changed the board logging routine and that is what check50 is complaining about. check50 depends on that output (log.txt) to verify the result. Here is the routine from the distribution code:

   // 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);
1
  • Thank you, it fix my problem. :D Mar 13 '17 at 12:30

You must log in to answer this question.

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