Nikoleta-v3 / Inferring-strategies-in-repeated-games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Definition of pure memory-1 strategies

yohm opened this issue · comments

Strategy Name Prescriptions: ($p_{CC}, p_{CD}, p_{DC}, p_{DD}$), initial Self-Sequence
M0 (AllC) (1, 1, 1, 1), C (C,C)(C,C)(C,C)(C,C)(C,C)
M1 (0, 1, 1, 1), C (C,C)(D,D)(C,C)(D,D)(C,C)
M2 (1, 0, 1, 1), C (C,C)(C,C)(C,C)(C,C)(C,C)
M3 (0, 0, 1, 1), C (C,C)(D,D)(C,C)(D,D)(C,C)
M4 (1, 1, 0, 1), C (C,C)(C,C)(C,C)(C,C)(C,C)
M5 (0, 1, 0, 1), C (C,C)(D,D)(C,C)(D,D)(C,C)
M6 (WSLS) (1, 0, 0, 1), C (C,C)(C,C)(C,C)(C,C)(C,C)
M7 (0, 0, 0, 1), C (C,C)(D,D)(C,C)(D,D)(C,C)
M8 (1, 1, 1, 0), C (C,C)(C,C)(C,C)(C,C)(C,C)
M9 (0, 1, 1, 0), C (C,C)(D,D)(D,D)(D,D)(D,D)
M10 (TFT) (1, 0, 1, 0), C (C,C)(C,C)(C,C)(C,C)(C,C)
M11 (0, 0, 1, 0), C (C,C)(D,D)(D,D)(D,D)(D,D)
M12 (1, 1, 0, 0), C (C,C)(C,C)(C,C)(C,C)(C,C)
M13 (0, 1, 0, 0), C (C,C)(D,D)(D,D)(D,D)(D,D)
M14 (GRIM) (1, 0, 0, 0), C (C,C)(C,C)(C,C)(C,C)(C,C)
M15 (AllD) (0, 0, 0, 0), C (C,C)(D,D)(D,D)(D,D)(D,D)
M16 (AllC) (1, 1, 1, 1), D (D,D)(C,C)(C,C)(C,C)(C,C)
M17 (0, 1, 1, 1), D (D,D)(C,C)(D,D)(C,C)(D,D)
M18 (1, 0, 1, 1), D (D,D)(C,C)(C,C)(C,C)(C,C)
M19 (0, 0, 1, 1), D (D,D)(C,C)(D,D)(C,C)(D,D)
M20 (1, 1, 0, 1), D (D,D)(C,C)(C,C)(C,C)(C,C)
M21 (0, 1, 0, 1), D (D,D)(C,C)(D,D)(C,C)(D,D)
M22 (WSLS) (1, 0, 0, 1), D (D,D)(C,C)(C,C)(C,C)(C,C)
M23 (0, 0, 0, 1), D (D,D)(C,C)(D,D)(C,C)(D,D)
M24 (1, 1, 1, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M25 (0, 1, 1, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M26 (TFT) (1, 0, 1, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M27 (0, 0, 1, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M28 (1, 1, 0, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M29 (0, 1, 0, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M30 (GRIM) (1, 0, 0, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)
M31 (AllD) (0, 0, 0, 0), D (D,D)(D,D)(D,D)(D,D)(D,D)

Code to generate this table.

import axelrod as axl

for i in range(32):
  # construct a strategy from a binary
  x = 31-i
  initial = C if x&16 else D
  q = axl.MemoryOnePlayer( (x&1, (x&2)>>1, (x&4)>>2, (x&8)>>3), initial=initial)
  match = axl.Match(players=[q, q], turns=5)
  _ = match.play()
  self_sequence = ""
  for (p1, p2) in match.result:
    self_sequence += "("
    self_sequence += "C," if p1 == C else "**D**,"
    self_sequence += "C" if p2 == C else "**D**"
    self_sequence += ")"
  print(f"| M{i} | {q} | {self_sequence} |")

How do I calculate the best response against pure memory-1 strategies? Someone must have already calculated it, and should be published in a textbook or manuscript although I cannot find an answer.

Strategy Name Prescriptions: ($p_{CC}, p_{CD}, p_{DC}, p_{DD}$)
ALLD (D) (0, 0, 0, 0, 0)
d1 (0, 0, 0, 0, 1)
d2 (0, 0, 0, 1, 0)
d3 (0, 0, 0, 1, 1)
d4 (0, 0, 1, 0, 0)
d5 (0, 0, 1, 0, 1)
d6 (0, 0, 1, 1, 0)
d7 (0, 0, 1, 1, 1)
GT (D) (0, 1, 0, 0, 0)
WSLS (D) (0, 1, 0, 0, 1)
TFT (D) (0, 1, 0, 1, 0)
d11 (0, 1, 0, 1, 1)
d12 (0, 1, 1, 0, 0)
d13 (0, 1, 1, 0, 1)
d14 (0, 1, 1, 1, 0)
ALLC (D) (0, 1, 1, 1, 1)
ALLD (D) (1, 0, 0, 0, 0)
d17 (1, 0, 0, 0, 1)
d18 (1, 0, 0, 1, 0)
d19 (1, 0, 0, 1, 1)
d20 (1, 0, 1, 0, 0)
d21 (1, 0, 1, 0, 1)
d22 (1, 0, 1, 1, 0)
d23 (1, 0, 1, 1, 1)
GT (C) (1, 1, 0, 0, 0)
WSLS (C) (1, 1, 0, 0, 1)
TFT (C) (1, 1, 0, 1, 0)
d27 (1, 1, 0, 1, 1)
d28 (1, 1, 1, 0, 0)
d29 (1, 1, 1, 0, 1)
d30 (1, 1, 1, 1, 0)
ALLC (C) (1, 1, 1, 1, 1)

How about we use the list above to be inline with the work of Kim, Choi and Baek? I am not sure if we want to keep track of the initial move in the name 🤷🏻

To generate the above strategies and labels/names I used the following code:

pure_strategies = list(itertools.product([0, 1], repeat=5))

labels = [f"d{i}" for i, _ in enumerate(pure_strategies)]

labels[0] = "ALLD (D)"
labels[16] = "ALLD (D)"

labels[15] = "ALLC (D)"
labels[31] = "ALLC (C)"

labels[8] = "GT (D)"
labels[24] = "GT (C)"

labels[9] = "WSLS (D)"
labels[25] = "WSLS (C)"

labels[10] = 'TFT (D)'
labels[26] = 'TFT (C)'

I agree. Let us make it consistent with the previous paper.