From d777f23d8f757af7ef17cf62f0184d094d63c782 Mon Sep 17 00:00:00 2001 From: Thomas Voss <thomasvoss@live.com> Date: Thu, 2 Dec 2021 06:07:55 +0100 Subject: Add day 2 solutions (got on global leaderboards) --- 2021/02/puzzle-1.awk | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 2021/02/puzzle-1.awk (limited to '2021/02/puzzle-1.awk') 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 } -- cgit v1.2.3