18 lines
468 B
Awk
18 lines
468 B
Awk
|
# A for Rock, B for Paper, and C for Scissors
|
||
|
# X for Rock, Y for Paper, and Z for Scissors
|
||
|
# 1 for Rock, 2 for Paper, and 3 for Scissors
|
||
|
# 0 if you lost, 3 if the round was a draw, and 6 if you won
|
||
|
|
||
|
$2 == "X" { S+= 1}
|
||
|
$2 == "Y" { S+= 2}
|
||
|
$2 == "Z" { S+= 3}
|
||
|
|
||
|
($1 == "A" && $2 == "X") ||
|
||
|
($1 == "B" && $2 == "Y") ||
|
||
|
($1 == "C" && $2 == "Z") { S+=3 } # draw
|
||
|
|
||
|
($1 == "A" && $2 == "Y") ||
|
||
|
($1 == "B" && $2 == "Z") ||
|
||
|
($1 == "C" && $2 == "X") { S+=6 } # win
|
||
|
|
||
|
END { print S }
|