update for 2023
This commit is contained in:
parent
525a33963b
commit
73b0f48925
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ build
|
||||
.clangd
|
||||
cmake-build-*
|
||||
tmpget.sh
|
||||
get_day.sh
|
@ -16,10 +16,11 @@ 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(GLOB SRC2023 src/2023/*.c)
|
||||
|
||||
file(COPY input DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC2019} ${SRC2020} ${SRC2021} ${SRC2022})
|
||||
add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC2019} ${SRC2020} ${SRC2021} ${SRC2022} ${SRC2023})
|
||||
|
||||
if ((${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD"))
|
||||
target_link_libraries(advent PRIVATE flint)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
mkdir -p include
|
||||
|
||||
for year in {2015..2022}; do
|
||||
for year in {2023..2023}; do
|
||||
rm -rf "src/${year}"
|
||||
mkdir -p "src/${year}"
|
||||
|
||||
|
58
include/advent2023.h
Normal file
58
include/advent2023.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef ADVENT_2023_H
|
||||
#define ADVENT_2023_H
|
||||
|
||||
void advent2023day01(void);
|
||||
void advent2023day02(void);
|
||||
void advent2023day03(void);
|
||||
void advent2023day04(void);
|
||||
void advent2023day05(void);
|
||||
void advent2023day06(void);
|
||||
void advent2023day07(void);
|
||||
void advent2023day08(void);
|
||||
void advent2023day09(void);
|
||||
void advent2023day10(void);
|
||||
void advent2023day11(void);
|
||||
void advent2023day12(void);
|
||||
void advent2023day13(void);
|
||||
void advent2023day14(void);
|
||||
void advent2023day15(void);
|
||||
void advent2023day16(void);
|
||||
void advent2023day17(void);
|
||||
void advent2023day18(void);
|
||||
void advent2023day19(void);
|
||||
void advent2023day20(void);
|
||||
void advent2023day21(void);
|
||||
void advent2023day22(void);
|
||||
void advent2023day23(void);
|
||||
void advent2023day24(void);
|
||||
void advent2023day25(void);
|
||||
|
||||
void (*solutions2023[25])(void) = {
|
||||
advent2023day01,
|
||||
advent2023day02,
|
||||
advent2023day03,
|
||||
advent2023day04,
|
||||
advent2023day05,
|
||||
advent2023day06,
|
||||
advent2023day07,
|
||||
advent2023day08,
|
||||
advent2023day09,
|
||||
advent2023day10,
|
||||
advent2023day11,
|
||||
advent2023day12,
|
||||
advent2023day13,
|
||||
advent2023day14,
|
||||
advent2023day15,
|
||||
advent2023day16,
|
||||
advent2023day17,
|
||||
advent2023day18,
|
||||
advent2023day19,
|
||||
advent2023day20,
|
||||
advent2023day21,
|
||||
advent2023day22,
|
||||
advent2023day23,
|
||||
advent2023day24,
|
||||
advent2023day25
|
||||
};
|
||||
|
||||
#endif
|
10
src/2023/01.c
Normal file
10
src/2023/01.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day01(void) {
|
||||
char *input = get_input("input/2023/01");
|
||||
printf("Solution for Day 01 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/02.c
Normal file
10
src/2023/02.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day02(void) {
|
||||
char *input = get_input("input/2023/02");
|
||||
printf("Solution for Day 02 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/03.c
Normal file
10
src/2023/03.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day03(void) {
|
||||
char *input = get_input("input/2023/03");
|
||||
printf("Solution for Day 03 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/04.c
Normal file
10
src/2023/04.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day04(void) {
|
||||
char *input = get_input("input/2023/04");
|
||||
printf("Solution for Day 04 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/05.c
Normal file
10
src/2023/05.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day05(void) {
|
||||
char *input = get_input("input/2023/05");
|
||||
printf("Solution for Day 05 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/06.c
Normal file
10
src/2023/06.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day06(void) {
|
||||
char *input = get_input("input/2023/06");
|
||||
printf("Solution for Day 06 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/07.c
Normal file
10
src/2023/07.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day07(void) {
|
||||
char *input = get_input("input/2023/07");
|
||||
printf("Solution for Day 07 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/08.c
Normal file
10
src/2023/08.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day08(void) {
|
||||
char *input = get_input("input/2023/08");
|
||||
printf("Solution for Day 08 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/09.c
Normal file
10
src/2023/09.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day09(void) {
|
||||
char *input = get_input("input/2023/09");
|
||||
printf("Solution for Day 09 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/10.c
Normal file
10
src/2023/10.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day10(void) {
|
||||
char *input = get_input("input/2023/10");
|
||||
printf("Solution for Day 10 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/11.c
Normal file
10
src/2023/11.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day11(void) {
|
||||
char *input = get_input("input/2023/11");
|
||||
printf("Solution for Day 11 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/12.c
Normal file
10
src/2023/12.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day12(void) {
|
||||
char *input = get_input("input/2023/12");
|
||||
printf("Solution for Day 12 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/13.c
Normal file
10
src/2023/13.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day13(void) {
|
||||
char *input = get_input("input/2023/13");
|
||||
printf("Solution for Day 13 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/14.c
Normal file
10
src/2023/14.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day14(void) {
|
||||
char *input = get_input("input/2023/14");
|
||||
printf("Solution for Day 14 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/15.c
Normal file
10
src/2023/15.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day15(void) {
|
||||
char *input = get_input("input/2023/15");
|
||||
printf("Solution for Day 15 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/16.c
Normal file
10
src/2023/16.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day16(void) {
|
||||
char *input = get_input("input/2023/16");
|
||||
printf("Solution for Day 16 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/17.c
Normal file
10
src/2023/17.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day17(void) {
|
||||
char *input = get_input("input/2023/17");
|
||||
printf("Solution for Day 17 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/18.c
Normal file
10
src/2023/18.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day18(void) {
|
||||
char *input = get_input("input/2023/18");
|
||||
printf("Solution for Day 18 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/19.c
Normal file
10
src/2023/19.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day19(void) {
|
||||
char *input = get_input("input/2023/19");
|
||||
printf("Solution for Day 19 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/20.c
Normal file
10
src/2023/20.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day20(void) {
|
||||
char *input = get_input("input/2023/20");
|
||||
printf("Solution for Day 20 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/21.c
Normal file
10
src/2023/21.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day21(void) {
|
||||
char *input = get_input("input/2023/21");
|
||||
printf("Solution for Day 21 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/22.c
Normal file
10
src/2023/22.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day22(void) {
|
||||
char *input = get_input("input/2023/22");
|
||||
printf("Solution for Day 22 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/23.c
Normal file
10
src/2023/23.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day23(void) {
|
||||
char *input = get_input("input/2023/23");
|
||||
printf("Solution for Day 23 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/24.c
Normal file
10
src/2023/24.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day24(void) {
|
||||
char *input = get_input("input/2023/24");
|
||||
printf("Solution for Day 24 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
10
src/2023/25.c
Normal file
10
src/2023/25.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
void advent2023day25(void) {
|
||||
char *input = get_input("input/2023/25");
|
||||
printf("Solution for Day 25 of 2023 is not completed yet\n");
|
||||
free(input);
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
#include "advent2020.h"
|
||||
#include "advent2021.h"
|
||||
#include "advent2022.h"
|
||||
#include "advent2023.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 3) {
|
||||
@ -26,7 +27,7 @@ int main(int argc, char **argv) {
|
||||
char buf[32];
|
||||
const char *errstr = NULL;
|
||||
|
||||
year = strtonum(argv[1], 15, 22, &errstr);
|
||||
year = strtonum(argv[1], 15, 23, &errstr);
|
||||
if (NULL != errstr) {
|
||||
printf("Input error: %s\n\n", errstr);
|
||||
return 1;
|
||||
@ -63,6 +64,9 @@ int main(int argc, char **argv) {
|
||||
case 22:
|
||||
solutions2022[day - 1]();
|
||||
break;
|
||||
case 23:
|
||||
solutions2023[day - 1]();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user