# Repeated Prisoner's Dilemma

submitted strategies:

1. defect every third time, and cooperate the rest of the time. I assume that you  start  with c,c. LV.

2. Step 1. First three moves are always Defect, Conform, Defect.
The worst case in this situation (refencing the values in our book) would yield -20 and best case -4.
Step 2.  Examine other players move in segments of 3 moves. Thus, player 1 would have these choices to look for: CCC, DCC, CDC, CCD, DDC, DDD, CDD, DCD and hte remaing quesiton is, what to do in each situation?
CCC, DCC, CDC, CCD - Choose D
DDD, CDD, DCD, DDC - Choose C

3. play tit-for-tat, except I will choose to defect on the first turn.

4.  begin cooperating until 9 games have been played.
Then my strategy is to then always average the last 9 moves, and play Tit for Tat according
what move the opponent played the most in the last 9 moves.

5. -COOPERATE on first turn.
-DEFECT on second turn.
-Subsequent turns look at opponents previous two moves, if opponent has played
*Both C, then COOPERATE.
*Both D, then DEFECT.
*One C and other D, then look at ALL of opponent's past moves and play
whichever he has played more often.  If he/she has cooperated and defected an
equal number of times, then DEFECT.

6. Start by cooperating.
If the opponent defects, then defect, otherwise keep cooperating.
Then, when you are defecting, and the opponent cooperates, then also
cooperate, otherwise keep defecting.
Thus, you mirror the opponent's last move and stay in the same state as
long as he does.
However, for each iteration, switch your strategy 25% of the time.
I assume that this means: Start by cooperating.  Then mirror the opponent's last move  with probability 75%. LV.

 1 2 3 4 5 1 (2cc+dd)/3 (2cd+dd)/3 (cc+dc+cd)/3 (2cc+dc)/3 (2cc+dc)/3 2 (2dc+dd)/3 (cc+dd)/2 (2cc+cd+dc+2dd)/6 (2cc+5cd+5dc+2dd)/14 (2cc+2cd+2cd+2dd)/8 3 (cc+dc+cd)/3 (2cc+cd+dc+2dd)/6 dd cc dd 4 (2cc+cd)/3 (2cc+5cd+5dc+2dd)/14 cc cc cc 5 (2cc+cd)/3 (2cc+2cd+2cd+2dd)/8 dd cc dd
 game from the textbook c d c -2, -2 ( bonus points: 8,8) -10, -1 (bonus points: 0, 9) d -1, -10 (bonus points 9,0) -5, -5 (bonus points: 5,5)

Bonus points:
1. (1.4cc+0.6cd+0.6dc+0.4dd)/3=(11.2+5.4+2)/3=18.6/3=6.2 ~ 6.
2. ((2dc+dd)/3+(cc+dd)/2+(2cc+cd+dc+2dd)/6+(2cc+5cd+5dc+2dd)/14+(2cc+2cd+2cd+2dd)/8)/5 =793/140~5.66~6.
3. (10cc+3cd+3dc+14dd)/30=(80+27+70)/30=5.9~6.
4. ((2cc+cd)/3+(2cc+5cd+5dc+2dd)/14+3cc)/5 ~ 6.88 ~7.
5.  ((2cc+cd)/3+(2cc+2cd+2cd+2dd)/8+2dd+cc)/5=319/60 ~5.32~5.
6. (6.08+5.5+5.5+5.97+5.68+5.5)/6 ~ 5.7 ~ 6 (pts).

2  d c d c  c d d d c c  c d d
3  d d c d  c c d d d c  c c d
period 6

2 & 2       d c       d c
period 2

2  d c d d   d d d d d d d c c c c c c c   d d d d d d d c c c c c c c
4  c c c c   c c c c c d d d d d d d c c   c c c c c d d d d d d d c c
period 14

5 c d  d d d c c c c d  d d d c c c c d
2 d c  d c c c c d d d  d c c c c d d d
period 8

1 c c d  c c d
2 d c d  d d d
period 3

1   c  c d c
3   d  c c d
period 3

1   c c d  c c d  c c d c c d
4   c c c  c c c  c c c c c c
period 3

1   c c d  c c d  c c d c c d
5   c d c  c c c  c c c c c c
period 3

6&1. (4cc+3cd+4dc+dd)/12 & (4cc+4cd+3dc+dd)/12 . ~ 6.08 & 5.33

6&2.  (cc+cd+dc+dd)/4 &  (cc+cd+dc+dd)/4.  5.5 & 5.5.

6&3.  (cc+cd+dc+dd)/4 &  (cc+cd+dc+dd)/4.  5.5 & 5.5.
(computing invariant probability distribution  for a Markov chain on 16 states)

6 & 4.  (cc+cd+dc+dd)/4 &  (cc+cd+dc+dd)/4. ~5.97, 5.97
(computing invariant probability distribution  for a Markov chain on 1024  states)

6& 5.  Eigenvectors[{{6,2,0,0,3,1,0,0},{0,0,0,0,3,1,0,0},{2,6,0,0,1,3,0,0},{0,0,0,0,1,3,0,0},
{0,0,3,1,0,0,0,0},  {0,0,3,1,0,0,6,2},  {0,0,1,3,0,0,0,0},  {0,0,1,3,0,0,2,6}}]
{10., 2., 7., 3., 3., 7., 2., 10.}/44
(computing invariant probability distribution  for a Markov chain on 8 states)
(13cc+9cd+9dc+13dd)/44 & (13cc+9cd+9dc+13dd)/44 . ~5.68 & 5.68.

6 & 6:.   (cc+cd+dc+dd)/4. 5.5

N[%/.{cc->8,cd->0,dc->9,dd->5}]