Advent of Code

Check-in [dc1fe09f05]
Login

Check-in [dc1fe09f05]

Overview
Comment:I like parenthesis around conditional expressions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dc1fe09f0514c1633e69dd88bc9029d7e57180f4363ddaabc24eec7a2e1719cf
User & Date: nnz on 2024-12-04 12:15:39
Other Links: manifest | tags
Context
2024-12-04
14:27
201501 1st star check-in: 7f37290fac user: nnz tags: trunk
12:15
I like parenthesis around conditional expressions check-in: dc1fe09f05 user: nnz tags: trunk
12:02
changed way of summing a boolean check-in: 4609a146ec user: nnz tags: trunk
Changes

Modified aoc2024.c from [5531243aa8] to [b9786e59e9].

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    if (data[rcmap(size, row-1, col-1)] == 'S') tmp |= 2;
    if (data[rcmap(size, row-1, col+1)] == 'M') tmp |= 4;
    if (data[rcmap(size, row-1, col+1)] == 'S') tmp |= 8;
    if (data[rcmap(size, row+1, col+1)] == 'M') tmp |= 1;
    if (data[rcmap(size, row+1, col+1)] == 'S') tmp |= 2;
    if (data[rcmap(size, row+1, col-1)] == 'M') tmp |= 4;
    if (data[rcmap(size, row+1, col-1)] == 'S') tmp |= 8;
    return tmp == 15;
}

void aoc202404(char *data, size_t len) {
    (void)len; // unused argument
    // assume data is well-formatted and has the same number of rows and columns
    unsigned size = strchr(data, '\n') - data;
    #if 0 // check assumption







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    if (data[rcmap(size, row-1, col-1)] == 'S') tmp |= 2;
    if (data[rcmap(size, row-1, col+1)] == 'M') tmp |= 4;
    if (data[rcmap(size, row-1, col+1)] == 'S') tmp |= 8;
    if (data[rcmap(size, row+1, col+1)] == 'M') tmp |= 1;
    if (data[rcmap(size, row+1, col+1)] == 'S') tmp |= 2;
    if (data[rcmap(size, row+1, col-1)] == 'M') tmp |= 4;
    if (data[rcmap(size, row+1, col-1)] == 'S') tmp |= 8;
    return (tmp == 15);
}

void aoc202404(char *data, size_t len) {
    (void)len; // unused argument
    // assume data is well-formatted and has the same number of rows and columns
    unsigned size = strchr(data, '\n') - data;
    #if 0 // check assumption