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 159 forks source link

Saving values between games #58

Open Leorias opened 3 years ago

Leorias commented 3 years ago

Because the memory variable gets wiped between games and only retained turn to turn, I imagine that it is not wanted that information about previous games can be saved.

I used a class with simple booleans and the value I set them to got retained from game to game. Example:

def strategy(history, memory):
    round = history.shape[1] + 1
    if round == 1:
        # This should never be 1
        print(MyMemory.test)
        return 1, MyMemory
    mem = memory
    mem.test = 1
    return 1, mem

class MyMemory:
    test = 0
cai-lw commented 3 years ago

Great catch. I submitted a mitigation as #60 that makes this example no longer work,.

There are still many ways to get around and I don't think it's possible to fix it completely. But I think in the end Cary will manually inspect all top ranking submissions no matter what, so it will not be a devastating issue.

jun-bun commented 3 years ago

is it unwanted or just unplanned for initially by @carykh ?