setup for 2022
This commit is contained in:
parent
5b68940efc
commit
6d6f3c5224
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ compile_commands.json
|
||||
build
|
||||
.clangd
|
||||
cmake-build-*
|
||||
tmpget.sh
|
||||
|
@ -15,10 +15,11 @@ file(GLOB SRC2018 src/2018/*.c)
|
||||
file(GLOB SRC2019 src/2019/*.c)
|
||||
file(GLOB SRC2020 src/2020/*.c)
|
||||
file(GLOB SRC2021 src/2021/*.c)
|
||||
file(GLOB SRC2022 src/2022/*.c)
|
||||
|
||||
file(COPY input DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC2019} ${SRC2020} ${SRC2021})
|
||||
add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC2019} ${SRC2020} ${SRC2021} ${SRC2022})
|
||||
|
||||
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin"))
|
||||
set(OPENSSL_ROOT_DIR /opt/homebrew/opt/openssl@3)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
mkdir -p include
|
||||
|
||||
for year in {2015..2021}; do
|
||||
for year in {2015..2022}; do
|
||||
rm -rf "src/${year}"
|
||||
mkdir -p "src/${year}"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
rm -rf input
|
||||
for year in {2015..2021}; do
|
||||
for year in {2015..2022}; do
|
||||
mkdir -p input/"$year"
|
||||
for day in {1..25}; do
|
||||
if [[ day -lt 10 ]]; then
|
||||
|
58
include/advent2022.h
Normal file
58
include/advent2022.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef ADVENT_2022_H
|
||||
#define ADVENT_2022_H
|
||||
|
||||
void advent2022day01(void);
|
||||
void advent2022day02(void);
|
||||
void advent2022day03(void);
|
||||
void advent2022day04(void);
|
||||
void advent2022day05(void);
|
||||
void advent2022day06(void);
|
||||
void advent2022day07(void);
|
||||
void advent2022day08(void);
|
||||
void advent2022day09(void);
|
||||
void advent2022day10(void);
|
||||
void advent2022day11(void);
|
||||
void advent2022day12(void);
|
||||
void advent2022day13(void);
|
||||
void advent2022day14(void);
|
||||
void advent2022day15(void);
|
||||
void advent2022day16(void);
|
||||
void advent2022day17(void);
|
||||
void advent2022day18(void);
|
||||
void advent2022day19(void);
|
||||
void advent2022day20(void);
|
||||
void advent2022day21(void);
|
||||
void advent2022day22(void);
|
||||
void advent2022day23(void);
|
||||
void advent2022day24(void);
|
||||
void advent2022day25(void);
|
||||
|
||||
void (*solutions2022[25])(void) = {
|
||||
advent2022day01,
|
||||
advent2022day02,
|
||||
advent2022day03,
|
||||
advent2022day04,
|
||||
advent2022day05,
|
||||
advent2022day06,
|
||||
advent2022day07,
|
||||
advent2022day08,
|
||||
advent2022day09,
|
||||
advent2022day10,
|
||||
advent2022day11,
|
||||
advent2022day12,
|
||||
advent2022day13,
|
||||
advent2022day14,
|
||||
advent2022day15,
|
||||
advent2022day16,
|
||||
advent2022day17,
|
||||
advent2022day18,
|
||||
advent2022day19,
|
||||
advent2022day20,
|
||||
advent2022day21,
|
||||
advent2022day22,
|
||||
advent2022day23,
|
||||
advent2022day24,
|
||||
advent2022day25
|
||||
};
|
||||
|
||||
#endif
|
10
src/2022/01.c
Normal file
10
src/2022/01.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day01(void) {
|
||||
char *input = get_input("input/2022/01");
|
||||
printf("Solution for Day 01 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/02.c
Normal file
10
src/2022/02.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day02(void) {
|
||||
char *input = get_input("input/2022/02");
|
||||
printf("Solution for Day 02 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/03.c
Normal file
10
src/2022/03.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day03(void) {
|
||||
char *input = get_input("input/2022/03");
|
||||
printf("Solution for Day 03 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/04.c
Normal file
10
src/2022/04.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day04(void) {
|
||||
char *input = get_input("input/2022/04");
|
||||
printf("Solution for Day 04 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/05.c
Normal file
10
src/2022/05.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day05(void) {
|
||||
char *input = get_input("input/2022/05");
|
||||
printf("Solution for Day 05 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/06.c
Normal file
10
src/2022/06.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day06(void) {
|
||||
char *input = get_input("input/2022/06");
|
||||
printf("Solution for Day 06 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/07.c
Normal file
10
src/2022/07.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day07(void) {
|
||||
char *input = get_input("input/2022/07");
|
||||
printf("Solution for Day 07 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/08.c
Normal file
10
src/2022/08.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day08(void) {
|
||||
char *input = get_input("input/2022/08");
|
||||
printf("Solution for Day 08 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/09.c
Normal file
10
src/2022/09.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day09(void) {
|
||||
char *input = get_input("input/2022/09");
|
||||
printf("Solution for Day 09 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/10.c
Normal file
10
src/2022/10.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day10(void) {
|
||||
char *input = get_input("input/2022/10");
|
||||
printf("Solution for Day 10 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/11.c
Normal file
10
src/2022/11.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day11(void) {
|
||||
char *input = get_input("input/2022/11");
|
||||
printf("Solution for Day 11 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/12.c
Normal file
10
src/2022/12.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day12(void) {
|
||||
char *input = get_input("input/2022/12");
|
||||
printf("Solution for Day 12 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/13.c
Normal file
10
src/2022/13.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day13(void) {
|
||||
char *input = get_input("input/2022/13");
|
||||
printf("Solution for Day 13 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/14.c
Normal file
10
src/2022/14.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day14(void) {
|
||||
char *input = get_input("input/2022/14");
|
||||
printf("Solution for Day 14 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/15.c
Normal file
10
src/2022/15.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day15(void) {
|
||||
char *input = get_input("input/2022/15");
|
||||
printf("Solution for Day 15 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/16.c
Normal file
10
src/2022/16.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day16(void) {
|
||||
char *input = get_input("input/2022/16");
|
||||
printf("Solution for Day 16 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/17.c
Normal file
10
src/2022/17.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day17(void) {
|
||||
char *input = get_input("input/2022/17");
|
||||
printf("Solution for Day 17 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/18.c
Normal file
10
src/2022/18.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day18(void) {
|
||||
char *input = get_input("input/2022/18");
|
||||
printf("Solution for Day 18 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/19.c
Normal file
10
src/2022/19.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day19(void) {
|
||||
char *input = get_input("input/2022/19");
|
||||
printf("Solution for Day 19 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/20.c
Normal file
10
src/2022/20.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day20(void) {
|
||||
char *input = get_input("input/2022/20");
|
||||
printf("Solution for Day 20 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/21.c
Normal file
10
src/2022/21.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day21(void) {
|
||||
char *input = get_input("input/2022/21");
|
||||
printf("Solution for Day 21 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/22.c
Normal file
10
src/2022/22.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day22(void) {
|
||||
char *input = get_input("input/2022/22");
|
||||
printf("Solution for Day 22 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/23.c
Normal file
10
src/2022/23.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day23(void) {
|
||||
char *input = get_input("input/2022/23");
|
||||
printf("Solution for Day 23 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/24.c
Normal file
10
src/2022/24.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day24(void) {
|
||||
char *input = get_input("input/2022/24");
|
||||
printf("Solution for Day 24 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2022/25.c
Normal file
10
src/2022/25.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2022day25(void) {
|
||||
char *input = get_input("input/2022/25");
|
||||
printf("Solution for Day 25 of 2022 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
#include "advent2019.h"
|
||||
#include "advent2020.h"
|
||||
#include "advent2021.h"
|
||||
#include "advent2022.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 3) {
|
||||
@ -25,7 +26,7 @@ int main(int argc, char **argv) {
|
||||
char buf[32];
|
||||
const char *errstr = NULL;
|
||||
|
||||
year = strtonum(argv[1], 15, 21, &errstr);
|
||||
year = strtonum(argv[1], 15, 22, &errstr);
|
||||
if (NULL != errstr) {
|
||||
printf("Input error: %s\n\n", errstr);
|
||||
return 1;
|
||||
@ -59,6 +60,9 @@ int main(int argc, char **argv) {
|
||||
case 21:
|
||||
solutions2021[day - 1]();
|
||||
break;
|
||||
case 22:
|
||||
solutions2022[day - 1]();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user