$24
This section asks you to implement a game of repeated prisoner's dilemma.
Prisoner's dilemma is a cooperation game. Two players simultaneously tell if they will cooperate or not in a given round. Points are awarded based on both player's cooperation (or not) decisions:
If both players cooperate with each other, each receives 2 points
If both players do not cooperate with each other, each receives 1 point
If one player cooperates while the other does not, the cooperating player gets 0 points, the non-cooperator receives 3 points
Repeated prisoner's dilemma has the two players continue to play rounds until one player reaches some threshold of points (this threshold is stored as score_to_win below).
What makes repeated prisoner's dilemma so fun is that the history of your opponents decisions allow you to make an informed decision about whether you should cooperate or not in the current round. In this implementation, we'll allow each player to choose to cooperate or not in a new round based exclusively on their opponents choice in the last round.