commit a9998acb73c9d2a482d00643687fd3aae187c57c
parent 3f99a98deed57aeaeb6a6cb01bef15591dfc6f1b
Author: Louis Burda <quent.burda@gmail.com>
Date: Tue, 2 Nov 2021 15:45:27 +0100
Small fixes
Diffstat:
11 files changed, 79 insertions(+), 19 deletions(-)
diff --git a/data/helper/config b/data/helper/config
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# year you are solving problems for
export AOCYEAR=2019
diff --git a/data/helper/template/Makefile b/data/helper/template/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = -I ../../libs/include -L ../../libs/build
+CFLAGS = -g -I ../../libs/include -L ../../libs/build
LDLIBS = -laoc
all: lib main
diff --git a/data/helper/template/main.c b/data/helper/template/main.c
@@ -1,17 +1,16 @@
+#include "aoc.h"
+
#include <stdlib.h>
#include <stdio.h>
-#include "partinfo.h"
-#include "util.h"
-
void
-part1(struct partinfo *p)
+part1(void)
{
}
void
-part2(struct partinfo *p)
+part2(void)
{
}
diff --git a/libs/include/aoc.h b/libs/include/aoc.h
@@ -22,7 +22,7 @@ extern struct aoc aoc;
void aoc_check(const char *sol, const char *fmtstr, ...);
void debug(const char *fmtstr, ...);
-void part1();
-void part2();
+void part1(void);
+void part2(void);
#endif
diff --git a/src/day1/main.c b/src/day1/main.c
@@ -1,11 +1,11 @@
+#include "aoc.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "aoc.h"
-
void
-part1()
+part1(void)
{
const char *line, *end, *nline;
char *endp;
@@ -32,7 +32,7 @@ part1()
}
void
-part2()
+part2(void)
{
const char *line, *end, *nline;
char *endp;
diff --git a/src/day2/main.c b/src/day2/main.c
@@ -5,7 +5,7 @@
#include <stdio.h>
void
-part1()
+part1(void)
{
struct icc config;
@@ -25,7 +25,7 @@ part1()
}
void
-part2()
+part2(void)
{
struct icc config;
void *instcopy;
diff --git a/src/day3/main.c b/src/day3/main.c
@@ -1,9 +1,9 @@
+#include "aoc.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "aoc.h"
-
struct line {
int sx, sy;
int ex, ey;
@@ -150,7 +150,7 @@ calc_dist(struct line *lines, struct line *end, int x, int y)
}
void
-part1()
+part1(void)
{
struct line *lines1, *lines2;
struct line *iter1, *iter2;
@@ -181,7 +181,7 @@ part1()
}
void
-part2()
+part2(void)
{
struct line *lines1, *lines2;
struct line *iter1, *iter2;
diff --git a/src/day4/Makefile b/src/day4/Makefile
@@ -0,0 +1,12 @@
+CFLAGS = -g -I ../../libs/include -L ../../libs/build
+LDLIBS = -laoc
+
+all: lib main
+
+clean:
+ rm main
+
+lib:
+ make -C ../../libs
+
+main: main.c
diff --git a/src/day4/input b/src/day4/input
@@ -0,0 +1 @@
+264793-803935
diff --git a/src/day4/main.c b/src/day4/main.c
@@ -0,0 +1,16 @@
+#include "aoc.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+void
+part1()
+{
+
+}
+
+void
+part2()
+{
+
+}
diff --git a/src/day4/part1 b/src/day4/part1
@@ -0,0 +1,32 @@
+--- Day 4: Secure Container ---
+
+You arrive at the Venus fuel depot only to discover it's protected by a password. The Elves had
+written the password on a sticky note, but someone threw it out.
+
+However, they do remember a few key facts about the password:
+
+
+ - It is a six-digit number.
+
+ - The value is within the range given in your puzzle input.
+
+ - Two adjacent digits are the same (like 22 in 1[1m[37m22[0m345).
+
+ - Going from left to right, the digits [1m[37mnever decrease[0m; they only ever increase or stay
+the same (like 111123 or 135679).
+
+
+Other than the range rule, the following are true:
+
+
+ - 111111 meets these criteria (double 11, never decreases).
+
+ - 2234[1m[37m50[0m does not meet these criteria (decreasing pair of digits 50).
+
+ - 123789 does not meet these criteria (no double).
+
+
+[1m[37mHow many different passwords[0m within the range given in your puzzle input meet these
+criteria?
+
+