finished 4a

This commit is contained in:
kirreen 2024-12-07 22:09:46 +01:00
parent 0339c7af10
commit 697f949deb
9 changed files with 362 additions and 14 deletions

BIN
2/a.out

Binary file not shown.

BIN
3/a.out Executable file

Binary file not shown.

View file

@ -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);
}

92
3/mainB.c Normal file
View file

@ -0,0 +1,92 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#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);
}

41
4/' Normal file
View file

@ -0,0 +1,41 @@
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<stdbool.h>
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
}

BIN
4/a.out Executable file

Binary file not shown.

140
4/input Normal file
View file

@ -0,0 +1,140 @@
ASAMXXXX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MSMMASMAXSMMMASAMXMSASXSASAMXMMMXSAMXSAXMMAMXMASXXXXSAMMSMSSMSAXAAXAMMMMMMAASMMMSASMMAXAAAAAAAXSXXSAAAAAAMMSMAMSXMAAMAXAAXASAMSM
MAAAAMAMAMAMXAASXMMAMXXXSXSXSAASAMAMMSXMXSMAAMASAMXSXSSSMAXXMMXXMAAASAAMAMXMSSSXSXASAMXMMAAASXMXMMMSMSSSMMSAAMSSSSSSMSAAMASXAMMSSMMMXSXMSXAX
MSMMMMMXAMAMMSMMAMMSXMAMMMSMSAXMMMAMXXMAMXMAMSAMAXXXMAXSAXMAXSASXSMASMMSSMAAXAXMSXSMSAMXSSMXSAAXXMAMAXAXASAMXMXAXMXXXMXSSMSMXMMAAXAXXMASXSSS

10
4/inputDemo Normal file
View file

@ -0,0 +1,10 @@
MMMSXXMASM
MSAMXMSMSA
AMXSXMAAMM
MSAMASMSMX
XMASAMXAMM
XXAMMXXAMA
SMSMSASXSS
SAXAMASAAA
MAMMMXMMMM
MXMXAXMASX

75
4/main.c Normal file
View file

@ -0,0 +1,75 @@
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<stdbool.h>
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);
}