1

My fifteen.c is working properly but check50 says it's not initialising right... It says: :( init initializes 3x3 board correctly \ expected file to be of length 18, not 19 :( init initializes 4x4 board correctly \ expected file to be of length 38, not 39 Any ideas where I to make a change? Thank you! Here my init function

void init(void)  
{
    int fulld = 1;  
        for (int i = 0; i < d; i++)  
        {
            for (int j = 0; j < d; j++)  
            {
                board[i][j] = d*d- fulld;  
                fulld ++;  
            }
        }  
    board[d-1][d-1] = 99;  
    if((d*d)%2 == 0)  
    {
        board[d-1][d-2] = 2;  
        board[d-1][d-3] = 1;  
    }
}
0

Since the test indicates that the log files are one character too long (the log files are used by check50 instead of the screen output), I suspect that the problem lies in the fact that you are using 99 to indicate the blank tile instead of 0 - a number that is 1 digit longer. Try using 0 for the blank. If not that, then I would ask if you are using the most current version of the download for this pset. Old versions from prior years are known to cause similar problems because both the given source code and check50 have been refined over time. Mismatching new and old leads to file length errors, but I'm more inclined to think that the problem is with 99.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • it was the 99... I had tried 0 before but I had several bugs and I thought they were because of the 0. I changed it to 99 and changed several other things... debugging can be a challange sometimes... Thank you very much!
    – user10882
    Apr 11 '16 at 14:58

You must log in to answer this question.

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