diff --git a/day3/p1.c b/day3/p1.c index f4dc094..3bd1572 100644 --- a/day3/p1.c +++ b/day3/p1.c @@ -3,10 +3,11 @@ #include #include #include -#include + #define ISDIGIT(c) (c >= 0x30 && c <= 0x39) + int main(int argc, char **argv) { FILE *input; char *line = NULL; @@ -57,9 +58,8 @@ int main(int argc, char **argv) { ((i+1 <= engine_lines-1 && j+1 <= engine_line_size-1) && !ISDIGIT(engine[i+1][j+1]) && engine[i+1][j+1] != '.') || ((i+1 <= engine_lines-1 && j-1 >= 0) && !ISDIGIT(engine[i+1][j-1]) && engine[i+1][j-1] != '.') || ((i-1 >= 0 && j+1 <= engine_line_size-1) && !ISDIGIT(engine[i-1][j+1]) && engine[i-1][j+1] != '.') || - ((i-1 >= 0 && j-1 >= 0) && !ISDIGIT(engine[i-1][j-1]) && engine[i-1][j-1] != '.'))) { + ((i-1 >= 0 && j-1 >= 0) && !ISDIGIT(engine[i-1][j-1]) && engine[i-1][j-1] != '.'))) adjacent = true; - } } if ((!ISDIGIT(engine[i][j]) || j == 0) && n != 0) { diff --git a/day3/p2.c b/day3/p2.c index 78d24b3..bead4db 100644 --- a/day3/p2.c +++ b/day3/p2.c @@ -3,12 +3,13 @@ #include #include #include -#include + #define ISDIGIT(c) (c >= 0x30 && c <= 0x39) uint64_t parse_number(char *line, ssize_t j); + int main(int argc, char **argv) { FILE *input; char *line = NULL;