From e7c9108b95e39d7ea5a29ae06d619c4727f11027 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 29 Oct 2021 23:02:39 +0200 Subject: Initial commit --- 2020/05/.gitignore | 1 + 2020/05/Makefile | 6 + 2020/05/input | 908 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2020/05/puzzle-1.awk | 2 + 2020/05/puzzle-2.awk | 11 + 2020/05/puzzles.sh | 4 + 2020/05/seatids.c | 37 +++ 7 files changed, 969 insertions(+) create mode 100644 2020/05/.gitignore create mode 100644 2020/05/Makefile create mode 100644 2020/05/input create mode 100644 2020/05/puzzle-1.awk create mode 100644 2020/05/puzzle-2.awk create mode 100755 2020/05/puzzles.sh create mode 100644 2020/05/seatids.c (limited to '2020/05') diff --git a/2020/05/.gitignore b/2020/05/.gitignore new file mode 100644 index 0000000..e2451f9 --- /dev/null +++ b/2020/05/.gitignore @@ -0,0 +1 @@ +seatids diff --git a/2020/05/Makefile b/2020/05/Makefile new file mode 100644 index 0000000..48f7dd4 --- /dev/null +++ b/2020/05/Makefile @@ -0,0 +1,6 @@ +all: + ${CC} ${CFLAGS} -o seatids seatids.c + +.PHONY: clean +clean: + rm -f seatids diff --git a/2020/05/input b/2020/05/input new file mode 100644 index 0000000..e3bc909 --- /dev/null +++ b/2020/05/input @@ -0,0 +1,908 @@ +FBBFBBBRLL +FBBFFBFLLL +BFFFFFFLRL +FBFBFFFLRR +BBBFBFBRLL +BFBBFFBRLL +BBFFFFBRLL +BFBFBBBLRR +FFBBFBFLLR +FBBBBFBRRR +FFBFBBFRLR +FBBFFFFRRR +BFBFFBFRRL +FFFBBFFLLL +FFFFBBFLLL +FFBFFBBRLL +FBBBBBFLRR +FFFBFFFLRR +FBBBBBFRLR +BFFBFFBLRL +FBBFBFBRRL +FBFBFBFRRR +FBBBFBFLRR +FFBBFBFRRL +FFBFFBFLRL +BFBFBFBLRR +BBFBBBFRRL +BFBFBBFRLL +FBBFBFBLLR +BFFFBFFLRR +FBBBFFFR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BLRR +FFBFBBBRRR +FFBFBBBRRL +BBFBBBFLRR +FBBFBBBLRR +FBFBFFBRLR +FBFFBBFRLL +BBFFFBFLRL +FBBFBFBRLR +BFBBBBFLLL +FBBFBBFLRR +FBFFFBBRRL +BBFFBFFLRL +BFFBBBFRRR +BFFBBFBLRR +FBFFFBBLLR +BFFFBFBRLL +FFBFBFBRLL +BBFBBFBRLL +BFFBFFBRRL +FFFFBBFLLR +BFBFBBBRLL +FFFFBBBRRR +FFBBBFBRRL +BFFBFBBRRL +BFBFBFBLLL +FFBFFFBRLR +FFBBFBFRLR +FBBBFFBLRR +BBFFBFFRRR +BFFFBFFLRL +BFBBFBFLLR +BBFBFFBLRL +FBBBFBBLLL +FFBBBBBRLR +BFBBFBBRLR +FBBBBFBRLL +FFBBBBFLRR +BFFFFFBLRL +BBFBFBBRRR \ No newline at end of file diff --git a/2020/05/puzzle-1.awk b/2020/05/puzzle-1.awk new file mode 100644 index 0000000..831c127 --- /dev/null +++ b/2020/05/puzzle-1.awk @@ -0,0 +1,2 @@ +$0 > max { max = $0 } +END { print max } diff --git a/2020/05/puzzle-2.awk b/2020/05/puzzle-2.awk new file mode 100644 index 0000000..8b9b823 --- /dev/null +++ b/2020/05/puzzle-2.awk @@ -0,0 +1,11 @@ +{ ids[NR] = $0 } + +END { + n = asort(ids) + for (i = 1; i <= n; i++) { + if ((i + 35) != ids[i]) { + print i + 35 + exit + } + } +} diff --git a/2020/05/puzzles.sh b/2020/05/puzzles.sh new file mode 100755 index 0000000..2066d76 --- /dev/null +++ b/2020/05/puzzles.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +./seatids | awk -f puzzle-1.awk +./seatids | gawk -f puzzle-2.awk diff --git a/2020/05/seatids.c b/2020/05/seatids.c new file mode 100644 index 0000000..9c3b797 --- /dev/null +++ b/2020/05/seatids.c @@ -0,0 +1,37 @@ +#include +#include + +/* Parse the input file `input` and print out all of the seat IDs which can be piped into both awk + * scripts + */ +int +main(void) +{ + FILE *fpt = fopen("input", "r"); + /* +2 for \n and \0 */ + char bpass[12]; + while (fgets(bpass, 12, fpt) != NULL) { + int lower_r = 0; + int upper_r = 127; + for (int i = 0; i < 7; i++) { + if (bpass[i] == 'F') + upper_r = (upper_r + lower_r) / 2; + else + lower_r = round((upper_r + lower_r) / 2); + } + + int lower_c = 0; + int upper_c = 7; + for (int i = 7; i < 10; i++) { + if (bpass[i] == 'L') + upper_c = (upper_c + lower_c) / 2; + else + lower_c = round((upper_c + lower_c) / 2); + } + + int seat_id = upper_r * 8 + upper_c; + printf("%d\n", seat_id); + } + + return 0; +} -- cgit v1.2.3