diff --git a/d02/part1b.awk b/d02/part1b.awk index d80be8c..6ab7384 100644 --- a/d02/part1b.awk +++ b/d02/part1b.awk @@ -1,13 +1,13 @@ #loose -$1=="A"&&$2=="Z"{S+=3;P+=6+1;next} -$1=="B"&&$2=="X"{S+=1;P+=6+2;next} -$1=="C"&&$2=="Y"{S+=2;P+=6+3;next} +$0=="A Z"{S+=3;P+=6+1;next} +$0=="B X"{S+=1;P+=6+2;next} +$0=="C Y"{S+=2;P+=6+3;next} #draw -$1=="A"&&$2=="X"{S+=3+1;P+=3+1;next} -$1=="B"&&$2=="Y"{S+=3+2;P+=3+2;next} -$1=="C"&&$2=="Z"{S+=3+3;P+=3+3;next} +$0=="A X"{S+=3+1;P+=3+1;next} +$0=="B Y"{S+=3+2;P+=3+2;next} +$0=="C Z"{S+=3+3;P+=3+3;next} #win -$1=="A"&&$2=="Y"{S+=6+2;P+=1;next} -$1=="B"&&$2=="Z"{S+=6+3;P+=2;next} -$1=="C"&&$2=="X"{S+=6+1;P+=3;next} +$0=="A Y"{S+=6+2;P+=1;next} +$0=="B Z"{S+=6+3;P+=2;next} +$0=="C X"{S+=6+1;P+=3;next} END{print S,P} \ No newline at end of file diff --git a/d02/part2b.awk b/d02/part2b.awk index 4e8b062..d7a81c6 100644 --- a/d02/part2b.awk +++ b/d02/part2b.awk @@ -1,13 +1,13 @@ #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} +$0=="A X"{S+=3;P+=6+1;next} +$0=="B X"{S+=1;P+=6+2;next} +$0=="C X"{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} +$0=="A Y"{S+=3+1;P+=3+1;next} +$0=="B Y"{S+=3+2;P+=3+2;next} +$0=="C Y"{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} +$0=="A Z"{S+=6+2;P+=1;next} +$0=="B Z"{S+=6+3;P+=2;next} +$0=="C Z"{S+=6+1;P+=3;next} END{print S,P}