carykh / PrisonersDilemmaTournament

Watch This Place's awesome video about iterated Prisoner's Dilemma for context! https://www.youtube.com/watch?v=BOvAbjfJ0x0
MIT License
205 stars 160 forks source link

Should my solution return 'tell truth'/'stay silent' or 0/1? #43

Closed xjcl closed 3 years ago

xjcl commented 3 years ago

The contest page links to the "policestation" branch where strategies returns strings ('tell truth'/'stay silent') but I just randomly saw that the "main" branch strategies return 0/1. Which one is right? Note that I already submitted my string-based version.

willow-iam commented 3 years ago

Both actually work.

if type(move) is str:
        defects = ["defect","tell truth"]
        return 0 if (move in defects) else 1
else:
        return move

code/prisonersDilemma.py line 32

xjcl commented 3 years ago

D'oh! Thanks.