aboutsummaryrefslogtreecommitdiff
path: root/2021/02/puzzle-1.awk
diff options
context:
space:
mode:
authorThomas Voss <thomasvoss@live.com> 2021-12-02 06:07:55 +0100
committerThomas Voss <thomasvoss@live.com> 2021-12-02 06:07:55 +0100
commitd777f23d8f757af7ef17cf62f0184d094d63c782 (patch)
treef841ae05b0a717c44fe26b2f7de57217d729828c /2021/02/puzzle-1.awk
parent9a4ea19ae955c86312c62098830a0f0e2994196d (diff)
Add day 2 solutions (got on global leaderboards)
Diffstat (limited to '2021/02/puzzle-1.awk')
-rwxr-xr-x2021/02/puzzle-1.awk6
1 files changed, 6 insertions, 0 deletions
diff --git a/2021/02/puzzle-1.awk b/2021/02/puzzle-1.awk
new file mode 100755
index 0000000..1caefc6
--- /dev/null
+++ b/2021/02/puzzle-1.awk
@@ -0,0 +1,6 @@
+#!/usr/bin/env -S awk -f
+
+/forward/ { hor += $2 }
+/up/ { ver -= $2 }
+/down/ { ver += $2 }
+END { print hor * ver }