Skip to content

AP Fifteen does not check won() #87

@dkiang

Description

@dkiang

Our CS50 AP course still uses the 2019 Fifteen pset. The provided check50 slug check50 cs50/problems/2019/ap/fifteen does not check for a correct implementation of won(). The following code passes check50 and submit50, even though board[d-1][d-1] is supposed to be a 0:

bool won(void) {
    int counter = 0;
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < d; j++) {
            if (board[i][j] == counter) {
                counter++;
            }
            else return false;
        }
    }
    return true;
}

In fact, changing the implementation of won() to just return true; or return false; also passes check50 so it doesn't seem to be checking won() at all. Can this be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions