add day 2 online solution
This commit is contained in:
parent
3c74beb814
commit
c600e6198c
|
@ -0,0 +1,12 @@
|
|||
# from /u/haveo on reddit
|
||||
# https://old.reddit.com/r/adventofcode/comments/zac2v2/2022_day_2_solutions/iynf98p/?context=3
|
||||
|
||||
{
|
||||
a = index("AB", $1)
|
||||
b = index("XYZ", $2)
|
||||
x += (b-a+4) % 3 * 3 + b
|
||||
y += 3 * b + (a+b) % 3 - 2
|
||||
}
|
||||
END {
|
||||
print "1: "x" 2: "y
|
||||
}
|
|
@ -2,6 +2,8 @@ my advent of code 2022 solutions
|
|||
|
||||
mainly going to be using shell + posix-defined utilities, probably
|
||||
|
||||
this repo will also include online solutions that I think are neat, indicated by "ONLINE" and with credit in the file
|
||||
|
||||
## Days
|
||||
1. awk (uses features exclusive to GNU's implementation, gawk)
|
||||
2. shell (completely POSIX-conforming implementation)
|
||||
|
|
Loading…
Reference in New Issue