Parse the input by splitting it into rounds and extracting the moves.
Determine the outcome of each round (win, loss, or draw) and calculate the score for that round.
Sum the scores for all rounds to get the total score.
Parse the input by splitting it into individual lines, with each line representing a round.
For each round, split the line into the two moves by splitting on the space between them.
Determine the outcome of the round by comparing the two moves. Rock defeats Scissors, Scissors defeats Paper, and Paper defeats Rock. If both players choose the same shape, the round is a draw.
Calculate the score for the round based on the outcome and the moves chosen. The score for a round is the score for the shape chosen (1 for Rock, 2 for Paper, and 3 for Scissors) plus the score for the outcome (0 if lost, 3 if a draw, and 6 if won).
Sum the scores for all rounds to get the total score.
Determine what shape to choose to achieve the desired outcome. If the desired outcome is X, choose a shape that would lose against the opponent’s shape. If the desired outcome is Y, choose the same shape as the opponent. If the desired outcome is Z, choose a shape that would win against the opponent’s shape.