Skip to main content
Commonmark migration
Source Link

##Tit-For-Time

Tit-For-Time

def tit_for_time(mine, theirs, state):
    theirs = theirs[-30:]
    no_rounds = len(theirs)
    return "c" if no_rounds < 5 or random.random() > theirs.count("d") / no_rounds else "d"

If you've been spending most of the time hurting me, I'll just hurt you back. Probably.

##Tit-For-Time

def tit_for_time(mine, theirs, state):
    theirs = theirs[-30:]
    no_rounds = len(theirs)
    return "c" if no_rounds < 5 or random.random() > theirs.count("d") / no_rounds else "d"

If you've been spending most of the time hurting me, I'll just hurt you back. Probably.

Tit-For-Time

def tit_for_time(mine, theirs, state):
    theirs = theirs[-30:]
    no_rounds = len(theirs)
    return "c" if no_rounds < 5 or random.random() > theirs.count("d") / no_rounds else "d"

If you've been spending most of the time hurting me, I'll just hurt you back. Probably.

Source Link
Blue
  • 28.6k
  • 8
  • 52
  • 100

##Tit-For-Time

def tit_for_time(mine, theirs, state):
    theirs = theirs[-30:]
    no_rounds = len(theirs)
    return "c" if no_rounds < 5 or random.random() > theirs.count("d") / no_rounds else "d"

If you've been spending most of the time hurting me, I'll just hurt you back. Probably.