Advent of Code

Check-in [4609a146ec]
Login

Check-in [4609a146ec]

Overview
Comment:changed way of summing a boolean
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4609a146ec720fc95e58c3265104ea77a360f60da8aeca79b787350c82b5ac79
User & Date: nnz on 2024-12-04 12:02:26
Other Links: manifest | tags
Context
2024-12-04
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
11:56
202404 2nd star check-in: 70a16d5d32 user: nnz tags: trunk
Changes

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

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    printf("ends with %c%c.\n", data[rcmap(size, size-1, size-2)], data[rcmap(size, size-1, size-1)]);
    #endif
    unsigned xmascount = 0, Xmascount = 0;
    for (unsigned row = 0; row < size; row++) {
        for (unsigned col = 0; col < size; col++) {
            xmascount += xmasat(data, size, row, col);
            if ((1 <= row) && (row < size - 1) && (1 <= col) && (col < size - 1)) {
                Xmascount += Xmasat(data, size, row, col);
            }
        }
    }
    printf("XMAS appears %u times in the little Elf's word search.\n", xmascount);
    printf("X-MAS appears %u times in the little Elf's word search.\n", Xmascount);
}








|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    printf("ends with %c%c.\n", data[rcmap(size, size-1, size-2)], data[rcmap(size, size-1, size-1)]);
    #endif
    unsigned xmascount = 0, Xmascount = 0;
    for (unsigned row = 0; row < size; row++) {
        for (unsigned col = 0; col < size; col++) {
            xmascount += xmasat(data, size, row, col);
            if ((1 <= row) && (row < size - 1) && (1 <= col) && (col < size - 1)) {
                if (Xmasat(data, size, row, col)) Xmascount++;
            }
        }
    }
    printf("XMAS appears %u times in the little Elf's word search.\n", xmascount);
    printf("X-MAS appears %u times in the little Elf's word search.\n", Xmascount);
}