aboutsummaryrefslogtreecommitdiff
path: root/2024
diff options
context:
space:
mode:
Diffstat (limited to '2024')
-rw-r--r--2024/02/puzzles.awk22
1 files changed, 8 insertions, 14 deletions
diff --git a/2024/02/puzzles.awk b/2024/02/puzzles.awk
index 789a193..da9ac93 100644
--- a/2024/02/puzzles.awk
+++ b/2024/02/puzzles.awk
@@ -27,23 +27,17 @@ function check(skip, xs, s, i, j, d, D)
}
# START PART 1
-{
- s = sign($1 - $2)
- n += check()
-}
+{ n += check() }
# END PART 1 START PART 2
-{
- s = sign($1 - $2)
- if (!check()) {
- for (i = 1; i <= NF; i++) {
- if (check(i))
- break
- }
- if (i > NF)
- next
+!check() {
+ for (i = 1; i <= NF; i++) {
+ if (check(i))
+ break
}
- n++
+ if (i > NF)
+ next
}
+{ n++ }
# END PART 2
END { print n } \ No newline at end of file