diff --git a/2/a.out b/2/a.out index 2ec387c..fa4e919 100755 Binary files a/2/a.out and b/2/a.out differ diff --git a/3/a.out b/3/a.out new file mode 100755 index 0000000..d9e3c16 Binary files /dev/null and b/3/a.out differ diff --git a/3/main.c b/3/main.c index b051d8e..4cb367f 100644 --- a/3/main.c +++ b/3/main.c @@ -12,7 +12,7 @@ struct instruction { void addInstruction(struct instruction *start, char *coord) { - // traverse list until null next + // traverse list until last member while(start->next) start = start->next; // allocate and store ptr @@ -24,8 +24,6 @@ void addInstruction(struct instruction *start, char *coord) } bool confirm_numbers(char *start, char *end) { - if (start >= end) - return 0; for (int i = 0; (start[i] >= '0' && start[i] <= '9') || start[i] == ','; i++) { if (start[i + 1 ] == ')') return 1; @@ -51,31 +49,24 @@ int parse_numbers(char *string) return a * b; } -int find_coord(char *instructions, int start) -{ - return 1; -} - - int main() { unsigned int sum = 0; char instructions[32]; - int a = 0; - int b = 0; FILE *input; input = fopen("./input", "r"); fseek(input, 0L, SEEK_END); unsigned int fLen = ftell(input); - char *memory = malloc(fLen * sizeof(char)); + char *memory = malloc(fLen * sizeof(char) + 1); rewind(input); fread(memory, fLen, sizeof(char), input); + memory[fLen + 1] = '\0'; fclose(input); - // find first instruction for the list head + // find first instruction start for the list head char *start = memory; start = strstr(start, "mul(") + 4; struct instruction *list = malloc(sizeof(struct instruction)); @@ -97,6 +88,5 @@ int main() current = current->next; } - printf("%d, %d\n", a, b); printf("%d\n", sum); } diff --git a/3/mainB.c b/3/mainB.c new file mode 100644 index 0000000..4cb367f --- /dev/null +++ b/3/mainB.c @@ -0,0 +1,92 @@ +#include +#include +#include +#include + +#define LINES 1000 + +struct instruction { + char *coord; + struct instruction *next; +}; + +void addInstruction(struct instruction *start, char *coord) +{ + // traverse list until last member + while(start->next) start = start->next; + + // allocate and store ptr + start->next = malloc(sizeof(struct instruction)); + + // store coords in new item + start->next->coord = coord; + start->next->next = 0; +} + +bool confirm_numbers(char *start, char *end) { + for (int i = 0; (start[i] >= '0' && start[i] <= '9') || start[i] == ','; i++) { + if (start[i + 1 ] == ')') + return 1; + } + return 0; +} + +int parse_numbers(char *string) +{ + int i = 0; + int a = 0; + int b = 0; + while (string[i] >= '0' && string[i] <= '9') { + a = a * 10 + string[i] - '0'; + i++; + } + // skip comma! + i++; + while (string[i] >= '0' && string[i] <= '9') { + b = b * 10 + string[i] - '0'; + i++; + } + return a * b; +} + +int main() +{ + unsigned int sum = 0; + char instructions[32]; + + FILE *input; + input = fopen("./input", "r"); + + fseek(input, 0L, SEEK_END); + unsigned int fLen = ftell(input); + char *memory = malloc(fLen * sizeof(char) + 1); + + rewind(input); + fread(memory, fLen, sizeof(char), input); + memory[fLen + 1] = '\0'; + fclose(input); + + // find first instruction start for the list head + char *start = memory; + start = strstr(start, "mul(") + 4; + struct instruction *list = malloc(sizeof(struct instruction)); + list->coord = start; + list->next = 0; + + // find the rest of the instructions and append to the linked list + while (start = strstr(start, "mul(")) { + start = start + 4; + // confirm format %d,%d) + if (confirm_numbers(start, memory + fLen)) + addInstruction(list, start); + } + + // from each instruction start, parse and mult numbers + struct instruction *current = list; + while (current) { + sum += parse_numbers(current->coord); + current = current->next; + } + + printf("%d\n", sum); +} diff --git a/4/' b/4/' new file mode 100644 index 0000000..91ebd95 --- /dev/null +++ b/4/' @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +int xmas_detector(char *x) +{ + int directions[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, + {1, 1}, {0, 1}, {-1, 1}, {-1, 0}}; + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 3; j++) { + + } + } +} + +int main () +{ + // make 2d array + FILE *input = fopen("./inputDemo", "r"); + int width = 0; + int height = 1; + while (fgetc(input) != '\n') width++; + for (char c = fgetc(input); c != EOF; c = fgetc(input)) { + if (c == '\n') + height++; + } + printf("%d\n%d\n", width, height); + + char **grid = malloc(width); + grid[0] = malloc(width * height); + for (int i = 1; i < width; i++) { + grid[i] = grid[0] + i * height; + } + + grid[0][2] = '5'; + + // find x + // + // confirm mas in all 8 directions +} diff --git a/4/a.out b/4/a.out new file mode 100755 index 0000000..6b652fa Binary files /dev/null and b/4/a.out differ diff --git a/4/input b/4/input new file mode 100644 index 0000000..8bf23b9 --- /dev/null +++ b/4/input @@ -0,0 +1,140 @@ +ASAMXXXXSSMMSMAXSAXXXMAMXAMXMMAMXMMMMSSMMMMMMMMMSMXSASXSMXMMMXAMSSSMSSXMXMASMSMMMSMASXMMMAMXMXMMXSXMASMSMXMASMXSMXMAMXMMSMSASAMXSXMAMSAMXSSS +SAMXSXXMAAAAXMXSAMXSMXMSSXXAMMAMAMXMAMASMAMAXMAMXAXSAXAXAASAMSAMAAAAAAASXMASMSAXAAXAMAMXMMXSSMMSAMXSXAAAAASAMXAMASXMASXAAAXASMSMSAAAXXAXXMAM +MAMAAAMAXSMMMMXSAXMAMAMMAMSMMSXSASMMMSAMXAXMSSXSMMMMMMSMSMSAMSAMMXMMMMASAMAMXSAMSSMMSMSMSMAMXAXMASAMXMSMXMSMXMXMAMAMASMMMSMMMAAAMXMAMMSMAMAM +SAMXSSXSMMMSAMASXMMASAMSAMAMXMAMMMXAMMASXSSMAMAAXXAAAMAAXXMMMSXMXSXAAXAMXMAMAMXMXAMXAAAAAMAMMSMMSAMXAMAMSMXMAMAMAXAMXMAAAXAAMMMMMXMAMSAMXSMS +MXMAMAAAXAAMAMMMMXSAMMXSMSXSAAMSMSMMMXASAMXMAXSMMXSMSSMSSMXMASMXXAMMMMSSXSASMMMASXMMMSMSMSXSAMAXXAXMXXASAMAXAXAMMMSXXXMMSSSMXSASASMSMAAXMAXA +XSAMXMSMMMSXXMASMMMSSMAMXXXSXSXAXAAAMMXMMMXMXXAAXMMAMXXAAMMMXSASXMAXXAXXASAXAAXMXMXSAMXAAXXMASMXSSMSSSXSAMXSSSMMSAMASMMAAAAAASMAAXAAMMMASXMS +MSASXXXASAMMXMAAXAAMXMSSSMAXAMMMSXSMSAMMSSMMMASAAAMAMMMSSMASMMAM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MAAAAAAAXSXX +AXAAAXXSMMXMAAAMAMSMMAAAMSMSMAXSAMAAMSAMXSAAXMXSXMAXAMAMAMSMMMMMAAMMXMAAASMMMSMMMAMAASMMSASXSAMAMASMSMAMMSXMXXXMMMMMMMMAMSXMMMMSSSMMMSMMMAAA +SSSSMSAMXSASMSMMASMAXSMMMASAMXMSASXSASAMXMMMXSAMXSAXMMAMXMASXXXXSAMMSMSSMSAXAAXAMMMMMMAASMMMSASMMAXAAAAAAAXSXXSAAAAAAMMSMAMSXMAAMAXAAXASAMSM +MAAAAMAMAMAMXAASXMMAMXXXSXSXSAASAMAMMSXMXSMAAMASAMXSXSSSMAXXMMXXMAAASAAMAMXMSSSXSXASAMXMMAAASXMXMMMSMSSSMMSAAMSSSSSSMSAAMASXAMMSSMMMXSXMSXAX +MSMMMMMXAMAMMSMMAMMSXMAMMMSMSAXMMMAMXXMAMXMAMSAMAXXXMAXSAXMAXSASXSMASMMSSMAAXAXMSXSMSAMXSSMXSAAXXMAMAXAXASAMXMXAXMXXXMXSSMSMXMMAAXAXXMASXSSS diff --git a/4/inputDemo b/4/inputDemo new file mode 100644 index 0000000..1f4eda2 --- /dev/null +++ b/4/inputDemo @@ -0,0 +1,10 @@ +MMMSXXMASM +MSAMXMSMSA +AMXSXMAAMM +MSAMASMSMX +XMASAMXAMM +XXAMMXXAMA +SMSMSASXSS +SAXAMASAAA +MAMMMXMMMM +MXMXAXMASX diff --git a/4/main.c b/4/main.c new file mode 100644 index 0000000..39c6482 --- /dev/null +++ b/4/main.c @@ -0,0 +1,75 @@ +#include +#include +#include +#include + +int xmas_detector(char **grid, int x, int y, int width) +{ + int real_xmas = 0; + char MAS[3] = {'M', 'A', 'S'}; + int dir[8][2] = + {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, + {1, 1}, {0, 1}, {-1, 1}, {-1, 0}}; + for (int i = 0; i < 8; i++) { + if (x + dir[i][0] * 3 < 0 || + y + dir[i][1] * 3 < 0 || + x + dir[i][0] * 3 >= width || + y + dir[i][1] * 3 >= width) + continue; + for (int j = 1; j <= 3; j++) { + // holy can you read that coordinate? + if (grid[x + dir[i][0] * j][y + dir[i][1] * j] != MAS[j - 1]) + break; + else if (j == 3) + real_xmas++; + } + } + + return real_xmas; +} + +int main () +{ + // figure out data dimensions + FILE *input = fopen("./input", "r"); + int width = 0; + int height = 1; + while (fgetc(input) != '\n') width++; + for (char c = fgetc(input); c != EOF; c = fgetc(input)) { + if (c == '\n') + height++; + } + rewind(input); + printf("Dimensions: %d x %d\n", width, height); + + // make 2d array + char **grid = malloc(width * sizeof(char*)); + grid[0] = malloc(width * height); + for (int i = 1; i < width; i++) { + grid[i] = grid[0] + i * height; + } + + // put the data in the array + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + grid[i][j] = fgetc(input); + } + // skip newline + fgetc(input); + } + fclose(input); + + // find x + int sum_xmas = 0; + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + if (grid[i][j] == 'X') + // confirm mas in all 8 dir + sum_xmas += xmas_detector(grid, i, j, width); + } + } + + printf("total xmases: %d\n", sum_xmas); + free(grid[0]); + free(grid); +}