aboutsummaryrefslogtreecommitdiff
path: root/2022/02/puzzle-2.awk
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2022-12-02 06:14:27 +0100
committerThomas Voss <mail@thomasvoss.com> 2022-12-02 06:14:27 +0100
commit151316492aa68d0e76e462d21c53a903dcdbe601 (patch)
treee44de279af173da2c1e6fd4c0391b9575c4521b9 /2022/02/puzzle-2.awk
parentfbeaf4fde52ebb89f07564685454cfc385dddb0d (diff)
Add 2022 day 2 solutions
Diffstat (limited to '2022/02/puzzle-2.awk')
-rwxr-xr-x2022/02/puzzle-2.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/2022/02/puzzle-2.awk b/2022/02/puzzle-2.awk
new file mode 100755
index 0000000..bcd090c
--- /dev/null
+++ b/2022/02/puzzle-2.awk
@@ -0,0 +1,10 @@
+#!/usr/bin/awk -f
+
+/Y/ { s += 3 }
+/Z/ { s += 6 }
+
+/A Y|B X|C Z/ { s += 1 }
+/B Y|C X|A Z/ { s += 2 }
+/C Y|A X|B Z/ { s += 3 }
+
+END { print s }