diff options
Diffstat (limited to '2022/day02/main.sh')
-rwxr-xr-x | 2022/day02/main.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/2022/day02/main.sh b/2022/day02/main.sh new file mode 100755 index 0000000..08f922a --- /dev/null +++ b/2022/day02/main.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# gleichstand 3 +# gewonnen 6 +# A X=Rock 1 +# B Y=Paper 2 +# C Z=Scissors 3 +# sed -e 's/\w \(\w\)/& \1/g' -e 's/X/A/' -e 's/Y/B/' -e 's/Z/C/' \ +# -e 's/\(A A\)\|\(B B\)\|\(C C\)/3/' -e 's/\(A B\)\|\(B C\)|\(C A\)/6/' \ +# -e 's/[ABC] [ABC] //' -e 's/X/1/' -e 's/Y/2/' -e 's/Z/3/' \ +# -e 's/ /+/' /dev/stdin \ +# | paste -sd+ + +cat /dev/stdin | sed -e 's/\w \(\w\)/& \1/g' -e 's/\(A X\)\|\(B Y\)\|\(C Z\)/3/' \ + -e 's/\(A Y\)\|\(B Z\)\|\(C X\)/6/' -e 's/[ABC] [XYZ] //' -e 's/X/1/' \ + -e 's/Y/2/' -e 's/Z/3/' -e 's/ /+/' | paste -sd+ | bc |