0

Game of fifteen is asking us to write code for draw function. It is then followed by following lines of program to log current state of board

My question is what is then the utility of the draw function?

// 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");

1 Answer 1

1

The log function is for the autograder (check50) so it can evaluate results for correctness and completeness.

The draw function is for the human so it can see the board to play the game (and also to evaluate correctness!).

You must log in to answer this question.

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