From ef2b2fc34efc99b2f043de7b5ca3f07029f62467 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 5 Dec 2024 09:48:38 +0100 Subject: Remove files --- 2024/05/puzzle-1.awk | 18 ------------------ 2024/05/puzzle-2.awk | 34 ---------------------------------- 2 files changed, 52 deletions(-) delete mode 100755 2024/05/puzzle-1.awk delete mode 100755 2024/05/puzzle-2.awk (limited to '2024/05') diff --git a/2024/05/puzzle-1.awk b/2024/05/puzzle-1.awk deleted file mode 100755 index 59616c9..0000000 --- a/2024/05/puzzle-1.awk +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/gawk -f - -BEGIN { FS = "[|,]" } - -/\|/ { rules[$1][$2] = 1 } -/,/ { - delete seen - for (i = 1; i <= NF; i++) { - for (j in seen) { - if (j in rules[$i]) - next - } - seen[$i] = 1 - } - mid += $(i / 2) -} - -END { print mid } \ No newline at end of file diff --git a/2024/05/puzzle-2.awk b/2024/05/puzzle-2.awk deleted file mode 100755 index 6e60b66..0000000 --- a/2024/05/puzzle-2.awk +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/gawk -f - -function sort_page_numbers(i1, v1, i2, v2) -{ - if (v1 in rules[v2]) - return +1 - if (v2 in rules[v1]) - return -1 - return 0 -} - -BEGIN { FS = "[|,]" } - -/\|/ { rules[$1][$2] = 1 } -/,/ { - delete seen - badent = 0 - - for (i = 1; i <= NF; i++) { - for (j in seen) { - if (j in rules[$i]) - badent = 1 - } - seen[$i] = 1 - } - if (!badent) - next - - split($0, xs) - asort(xs, xs, "sort_page_numbers") - mid += xs[(NF + 1) / 2] -} - -END { print mid } \ No newline at end of file -- cgit v1.2.3