aoc2022/d02/part2b.awk

14 lines
354 B
Awk

#loose
$2=="X"&&$1=="A"{S+=3;P+=6+1;next}
$2=="X"&&$1=="B"{S+=1;P+=6+2;next}
$2=="X"&&$1=="C"{S+=2;P+=6+3;next}
#draw
$2=="Y"&&$1=="A"{S+=3+1;P+=3+1;next}
$2=="Y"&&$1=="B"{S+=3+2;P+=3+2;next}
$2=="Y"&&$1=="C"{S+=3+3;P+=3+3;next}
#win
$2=="Z"&&$1=="A"{S+=6+2;P+=1;next}
$2=="Z"&&$1=="B"{S+=6+3;P+=2;next}
$2=="Z"&&$1=="C"{S+=6+1;P+=3;next}
END{print S,P}