aboutsummaryrefslogtreecommitdiff
path: root/2021/02/puzzle-2.awk
blob: 73fe23e5db1256393f8fa699e6eab719cf375296 (plain) (blame)
1
2
3
4
5
6
#!/usr/bin/env -S awk -f

/forward/ { hor += $2; ver += aim * $2 }
/up/      { aim -= $2 }
/down/    { aim += $2 }
END       { print hor * ver }