Overview
| Comment: | removed dead code |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
278fc62fcc4cf1988a6b144adf332333 |
| User & Date: | nnz on 2024-12-07 13:52:08.034 |
| Other Links: | manifest | tags |
Context
|
2024-12-07
| ||
| 14:37 | fixed possible bug check-in: c6ad316f4d user: nnz tags: trunk | |
| 13:52 | removed dead code check-in: 278fc62fcc user: nnz tags: trunk | |
| 13:50 | reworked operators insertion logic check-in: 9237d89a9a user: nnz tags: trunk | |
Changes
Modified aoc2024.c
from [98d4a70597]
to [5ec424337a].
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
switch (operatorsrequired(testvalue, number, nnumber, 0)) {
default: break;
case 2: calibrationtotal += testvalue;
__attribute__((fallthrough));
case 3: calibration3total += testvalue;
break;
}
| < < < < < < < < | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
switch (operatorsrequired(testvalue, number, nnumber, 0)) {
default: break;
case 2: calibrationtotal += testvalue;
__attribute__((fallthrough));
case 3: calibration3total += testvalue;
break;
}
line = strtok(NULL, "\n");
}
printf("The calibration total is {%llu}.\n", calibrationtotal);
printf("The calibration total with three operators is {%llu}.\n", calibration3total);
}
/* === aoc202406 =======================================================
|
| ︙ | ︙ | |||
282 283 284 285 286 287 288 |
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;
| < < < < < < < < < < < < | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
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;
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++;
}
|
| ︙ | ︙ |