Day 2: Rock Paper Scissors
- Posted 2022-12-17
The second AoC challenge provides a plain-text file containing a series of plays of Rock, Paper, Scissors, represented by the letters A, B and C respectively for the player and X, Y and Z respectively for the opponent. For example:
B Z B X C Y B Y B Y
It then goes on to detail a scoring system, in which a score of 1, 2 and 3 is allocated for using Rock, Paper and Scissors respectively. A further score is added based on the outcome of the round: 0 for a loss, 3 for a draw, and 6 for a win.
The actual challenge is, given a record of many rounds of Rock, Paper, Scissors in the format shown above, to calculate the total score that was achieved.
First, we read in the input using 0:.
Output: :: ("B Z" "B X" "C Y" "B Y" "B Y")