From 4819b63b8d4357a5544f2f79ae73371ba0d7b092 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Mon, 25 Dec 2023 11:39:35 +1200 Subject: [PATCH] Updoots --- .vscode/bolerplate.code-snippets | 36 ++++++++++++++++ .vscode/tasks.json | 5 ++- day1/puzzle2/main.c | 12 +++--- day4/libs | 2 +- day4/puzzle2.c | 41 ++++++++++-------- day5/input | 33 ++++++++++++++ day5/input_test | 33 ++++++++++++++ day5/libs | 1 + day5/out.list | 11 +++++ day5/parser.c | 65 ++++++++++++++++++++++++++++ day5/parser.h | 9 ++++ day5/puzze1 | Bin 0 -> 20160 bytes day5/puzzle1.c | 23 ++++++++++ day5/puzzle2.c | 11 +++++ day5/structs.c | 0 day5/structs.h | 72 +++++++++++++++++++++++++++++++ libs/fileLoader.h | 4 +- 17 files changed, 329 insertions(+), 29 deletions(-) create mode 100644 .vscode/bolerplate.code-snippets create mode 100644 day5/input create mode 100644 day5/input_test create mode 120000 day5/libs create mode 100644 day5/out.list create mode 100644 day5/parser.c create mode 100644 day5/parser.h create mode 100755 day5/puzze1 create mode 100644 day5/puzzle1.c create mode 100644 day5/puzzle2.c create mode 100644 day5/structs.c create mode 100644 day5/structs.h diff --git a/.vscode/bolerplate.code-snippets b/.vscode/bolerplate.code-snippets new file mode 100644 index 0000000..611ff54 --- /dev/null +++ b/.vscode/bolerplate.code-snippets @@ -0,0 +1,36 @@ +{ + // Place your aoc-2023 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "Boilerplate": { + "scope": "c", + "prefix": "bplate", + "body": [ + "#include ", + "#include ", + "#include \"libs/fileLoader.h\"", + "", + "int main()", + "{", + " char *filename = \"input\";", + " struct OpenFile *o_file = load_file_to_mem(filename);", + "", + " return 0;", + "}", + ], + "description": "Boilder plate AOC" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 76f1d11..a752010 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,11 +7,12 @@ "args": [ "-fdiagnostics-color=always", "-g", - "${file}", + "puzzle1.c", "-o", "${fileDirname}/${fileBasenameNoExtension}", "libs/fileLoader.c", - "libs/strTools.c" + "libs/strTools.c", + "parser.c" ], "options": { "cwd": "${fileDirname}" diff --git a/day1/puzzle2/main.c b/day1/puzzle2/main.c index d0f7274..6270d6f 100644 --- a/day1/puzzle2/main.c +++ b/day1/puzzle2/main.c @@ -16,20 +16,22 @@ int two_char_two_interger(int a, int b) return num; } -int is_num(char *test_string, char *num_to_match, int mem_length) { +int is_num(char *test_string, char *num_to_match, int mem_length) +{ char *input_copy = malloc(mem_length); - + memcpy(input_copy, test_string, (size_t)mem_length); - if (strcmp(input_copy, num_to_match) == 0) { - return 0; + if (strcmp(input_copy, num_to_match) == 0) + { + return 0; } return 1; } int main() { - const char *inputFile = "/home/ben/Documents/Projects/C/advent-of-code/day1/puzzle1/input"; + const char *inputFile = "input"; int fd = open(inputFile, O_RDONLY); if (fd < 0) diff --git a/day4/libs b/day4/libs index 7cb0c1a..d4bda9b 120000 --- a/day4/libs +++ b/day4/libs @@ -1 +1 @@ -/home/ben/Documents/Projects/C/advent-of-code/libs \ No newline at end of file +../libs \ No newline at end of file diff --git a/day4/puzzle2.c b/day4/puzzle2.c index 2e506dd..b8680e9 100644 --- a/day4/puzzle2.c +++ b/day4/puzzle2.c @@ -4,22 +4,25 @@ #include "libs/fileLoader.h" #include "libs/strTools.h" +#define testing + #define MAX_STR_LEN 255 +#ifdef testing #define LineCount 7 #define OUR_LEN 5 #define WIN_LEN 8 - +#else // defaults -// #define LineCount 219 -// #define OUR_LEN 10 -// #define WIN_LEN 25 - +#define LineCount 219 +#define OUR_LEN 10 +#define WIN_LEN 25 +#endif struct ScratchCards { int cards[LineCount]; }; -struct Game +typedef struct Game { int ourNumbers[OUR_LEN]; int ourIterator; @@ -28,17 +31,17 @@ struct Game int gamesWon; int game_id; -}; +} Game; -struct Games +typedef struct Games { - struct Game games[LineCount]; + Game games[LineCount]; int iterator; -}; +} Games; -struct Game *lineParser(char *line) // , struct Games *games +Game *lineParser(char *line) // , Games *games { - struct Game *game = malloc(sizeof(struct Game)); + Game *game = malloc(sizeof(Game)); game->ourIterator = 0; game->winIterator = 0; game->gamesWon = 0; @@ -127,7 +130,7 @@ int main() int total = 0; // Load the input file into my structs - struct Games *games = malloc(sizeof(struct Games)); + Games *games = malloc(sizeof(Games)); games->iterator = 0; // char *line = (char *)malloc(MAX_STR_LEN); // Start new line variable? @@ -158,7 +161,7 @@ int main() cards->cards[i] = 1; } - for (int gameId = 0; gameId <= LineCount; gameId++) + for (int gameId = 0; gameId < LineCount - 1; gameId++) { if (gameId == games->iterator) { @@ -166,12 +169,12 @@ int main() } // cards->cards[gameId] += 1; Uneeded as we default them to 1 games won int winningGames = games->games[gameId].gamesWon; - int iterations = winningGames + cards->cards[gameId]; - for (int i = 1; i <= iterations; i++) + int iterations = winningGames * cards->cards[gameId]; + for (int i = 0; i <= iterations; i++) { - if (cards->cards[gameId + i] < LineCount - 1) + if (gameId + (i + 1) <= LineCount) { - cards->cards[gameId + i]++; + cards->cards[gameId + (i + 1)]++; } } // int winningGames = games->games[gameId].gamesWon; @@ -182,7 +185,7 @@ int main() } // Finish sad loop and cry - for (int i = 0; i < LineCount; i++) + for (int i = 0; i <= LineCount; i++) { total += cards->cards[i]; } diff --git a/day5/input b/day5/input new file mode 100644 index 0000000..bd902a4 --- /dev/null +++ b/day5/input @@ -0,0 +1,33 @@ +seeds: 79 14 55 13 + +seed-to-soil map: +50 98 2 +52 50 48 + +soil-to-fertilizer map: +0 15 37 +37 52 2 +39 0 15 + +fertilizer-to-water map: +49 53 8 +0 11 42 +42 0 7 +57 7 4 + +water-to-light map: +88 18 7 +18 25 70 + +light-to-temperature map: +45 77 23 +81 45 19 +68 64 13 + +temperature-to-humidity map: +0 69 1 +1 0 69 + +humidity-to-location map: +60 56 37 +56 93 4 \ No newline at end of file diff --git a/day5/input_test b/day5/input_test new file mode 100644 index 0000000..bd902a4 --- /dev/null +++ b/day5/input_test @@ -0,0 +1,33 @@ +seeds: 79 14 55 13 + +seed-to-soil map: +50 98 2 +52 50 48 + +soil-to-fertilizer map: +0 15 37 +37 52 2 +39 0 15 + +fertilizer-to-water map: +49 53 8 +0 11 42 +42 0 7 +57 7 4 + +water-to-light map: +88 18 7 +18 25 70 + +light-to-temperature map: +45 77 23 +81 45 19 +68 64 13 + +temperature-to-humidity map: +0 69 1 +1 0 69 + +humidity-to-location map: +60 56 37 +56 93 4 \ No newline at end of file diff --git a/day5/libs b/day5/libs new file mode 120000 index 0000000..d4bda9b --- /dev/null +++ b/day5/libs @@ -0,0 +1 @@ +../libs \ No newline at end of file diff --git a/day5/out.list b/day5/out.list new file mode 100644 index 0000000..ea56782 --- /dev/null +++ b/day5/out.list @@ -0,0 +1,11 @@ +"#include ", +"#include ", +"#include "libs/fileLoader.h"", +"", +"int main()", +"{", +" char *filename = "input";", +" struct OpenFile *o_file = load_file_to_mem(filename);", +"", +" return 0;", +"}", diff --git a/day5/parser.c b/day5/parser.c new file mode 100644 index 0000000..71b9e99 --- /dev/null +++ b/day5/parser.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include "libs/fileLoader.h" +#include "structs.h" + +#define MAX_STR_LEN 1024 + +const char *SEED_TXT = "seeds"; +const char *SEEDTOSOIL_TXT = "seed-to-soil map:"; +const char *SOILTOFERI_TXT = "soil-to-fertilizer map"; +const char *FERTITOWATER_TXT = "fertilizer-to-water map"; +const char *WATERTOLIGHT_TXT = "water-to-light map"; +const char *LIGHTTOTEMP_TXT = "light-to-temperature map"; +const char *TEMPTOHUMID_TXT = "temperature-to-humidity map"; +const char *HUMIDTOLOC_TXT = "humidity-to-location map"; + +Almanac *parseFile(OpenFile *file) +{ + Almanac *data = (Almanac *)malloc(sizeof(Almanac)); + for (int iterator = 0; iterator < file->fileSize; iterator++) + { + // Initialize the data + data->seeds = (Seeds *)malloc(sizeof(Seeds)); + data->seedtosoil = (SeedToSoilMap *)malloc(sizeof(SeedToSoilMap)); + data->soiltoferti = (SoilToFertiMap *)malloc(sizeof(SoilToFertiMap)); + data->ferttowater = (FertiToWaterMap *)malloc(sizeof(FertiToWaterMap)); + data->watertplight = (WaterToLightMap *)malloc(sizeof(WaterToLightMap)); + data->lighttotemp = (LightToTempMap *)malloc(sizeof(LightToTempMap)); + data->temptohumid = (TempToHumidMap *)malloc(sizeof(TempToHumidMap)); + data->humidtoloc = (HumidToLocMap *)malloc(sizeof(HumidToLocMap)); + + const char DELIM[2] = ":"; + char *token; + char *save_ptr; + + for (int i = 0; i < file->fileSize; i++) + { + char *tmpString = (char *)malloc(MAX_STR_LEN); + if (file->fileData[i] == '\n') + { + token = strtok_r(tmpString, DELIM, &save_ptr); + continue; + } + tmpString[i] = file->fileData[i]; + } + + // const char NEWLN_DELIM[2] = "\n"; + // char *line_token; + // char *line_save_ptr; + + // line_token = strtok_r(file->fileData, NEWLN_DELIM, &line_save_ptr); + // while (line_token != NULL) + // { + // if (strcmp(line_token, SEED_TXT) == 0) + // { + // printf("We looking at seeds"); + // } + + // line_token = strtok_r(NULL, file->fileData, &line_save_ptr); + // } + } + + return data; +} \ No newline at end of file diff --git a/day5/parser.h b/day5/parser.h new file mode 100644 index 0000000..efd77b5 --- /dev/null +++ b/day5/parser.h @@ -0,0 +1,9 @@ +#ifndef fileparser +#define fileparser +#include "structs.h" +#include "parser.h" +#include "libs/fileLoader.h" + +Almanac *parseFile(OpenFile *file); + +#endif \ No newline at end of file diff --git a/day5/puzze1 b/day5/puzze1 new file mode 100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Pc*3DwyxmIbN@-*ln#SPlto4+~NDEpRK+Bbgq zoI>1dzqUi!|A|plq!Yhk6MCAEny2|-iel#BCBQir%y=;KS0#96>;QF2&w7OhJkCwK UMzJ2qO!hlADvdsmfrk|T3sbo66951J literal 0 HcmV?d00001 diff --git a/day5/puzzle1.c b/day5/puzzle1.c new file mode 100644 index 0000000..0ff09d3 --- /dev/null +++ b/day5/puzzle1.c @@ -0,0 +1,23 @@ +#include +#include +#include "structs.h" +#include "libs/fileLoader.h" +#include "parser.h" + +#define testing + +#ifdef testing +#define FNAME "input_test" +#else +#define FNAME "input" +#endif + +int main() +{ + char *filename = FNAME; + struct OpenFile *o_file = load_file_to_mem(filename); + + Almanac *data = parseFile(o_file); + + return 0; +} \ No newline at end of file diff --git a/day5/puzzle2.c b/day5/puzzle2.c new file mode 100644 index 0000000..13387a3 --- /dev/null +++ b/day5/puzzle2.c @@ -0,0 +1,11 @@ +#include +#include +#include "libs/fileLoader.h" + +int main() +{ + char *filename = "input"; + struct OpenFile *o_file = load_file_to_mem(filename); + + return 0; +} \ No newline at end of file diff --git a/day5/structs.c b/day5/structs.c new file mode 100644 index 0000000..e69de29 diff --git a/day5/structs.h b/day5/structs.h new file mode 100644 index 0000000..1fb8fe6 --- /dev/null +++ b/day5/structs.h @@ -0,0 +1,72 @@ +#ifndef structybois +#define structybois + +typedef struct Maps +{ + int *nums; +} Maps; + +typedef struct Seeds +{ + Maps *nums; +} Seeds; + +typedef struct SeedToSoilMap +{ + Maps *first; + Maps *second; +} SeedToSoilMap; + +typedef struct SoilToFertiMap +{ + Maps *first; + Maps *second; + Maps *third; +} SoilToFertiMap; + +typedef struct FertiToWaterMap +{ + Maps *first; + Maps *second; + Maps *third; + Maps *fourth; +} FertiToWaterMap; + +typedef struct WaterToLightMap +{ + Maps *irst; + Maps *second; +} WaterToLightMap; + +typedef struct LightToTempMap +{ + Maps *first; + Maps *second; + Maps *third; +} LightToTempMap; + +typedef struct TempToHumidMap +{ + Maps *first; + Maps *second; +} TempToHumidMap; + +typedef struct HumidToLocMap +{ + Maps *first; + Maps *second; +} HumidToLocMap; + +typedef struct Almanac +{ + Seeds *seeds; + SeedToSoilMap *seedtosoil; + SoilToFertiMap *soiltoferti; + FertiToWaterMap *ferttowater; + WaterToLightMap *watertplight; + LightToTempMap *lighttotemp; + TempToHumidMap *temptohumid; + HumidToLocMap *humidtoloc; +} Almanac; + +#endif \ No newline at end of file diff --git a/libs/fileLoader.h b/libs/fileLoader.h index 666f5cc..94120e6 100644 --- a/libs/fileLoader.h +++ b/libs/fileLoader.h @@ -1,10 +1,10 @@ #ifndef fileloader #define fileloader -struct OpenFile +typedef struct OpenFile { char *fileData; int fileSize; -}; +} OpenFile; struct OpenFile *load_file_to_mem(char *filename); int unmap_file(char *ptr, char *filename);