diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-12-02 22:41:22 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-12-02 22:41:22 +0100 |
commit | 5efcc8160c38889eaa70cf2f10089e9d2d1450b5 (patch) | |
tree | eb0205fa7259e31e38c6a765a037f1c4af0ea8dc /2024 | |
parent | bf7c30c0e5f4d54efb8b9c679294dbd3238d563b (diff) |
Refactor
Diffstat (limited to '2024')
-rw-r--r-- | 2024/02/puzzles.awk | 22 |
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 |