22 lines
959 B
Awk
22 lines
959 B
Awk
|
# A for Rock, B for Paper, and C for Scissors
|
||
|
# X need to lose, Y need a draw, and Z need to win.
|
||
|
# 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
|
||
|
|
||
|
# to loose
|
||
|
($2 == "X") && ($1 == "A") { S+= 0 + 3; } # A for Rock, need scisors, worth 3
|
||
|
($2 == "X") && ($1 == "B") { S+= 0 + 1; } # B for Paper, need rock, worth 1
|
||
|
($2 == "X") && ($1 == "C") { S+= 0 + 2; } # C for Scissors, need papaer, worth 2
|
||
|
|
||
|
# to draw
|
||
|
($2 == "Y") && ($1 == "A") { S+= 3 + 1; } # A for Rock, need rock, worth 1
|
||
|
($2 == "Y") && ($1 == "B") { S+= 3 + 2; } # B for Paper, need paper, worth 2
|
||
|
($2 == "Y") && ($1 == "C") { S+= 3 + 3; } # C for Scissors, need scissors, worth 3
|
||
|
|
||
|
# to win
|
||
|
($2 == "Z") && ($1 == "A") { S+= 6 + 2; } # A for Rock, need paper, worth 2
|
||
|
($2 == "Z") && ($1 == "B") { S+= 6 + 3; } # B for Paper, need scissors, worth 3
|
||
|
($2 == "Z") && ($1 == "C") { S+= 6 + 1; } # C for Scissors, nee rock, worth 1
|
||
|
|
||
|
END { print S }
|