

@staticmethod
def strategy(opponent):
    'Looks at opponent history to see if they have defected.\n\n        If so, player defection is inversely proportional to when this occurred.\n        '
    index = next((index for (index, value) in enumerate(opponent.history, start=1) if (value == D)), None)
    if (opponent is None):
        return C
    return random_choice((1 - (1 / float(abs(index)))))

dataset/ETHPy150Open Axelrod-Python/Axelrod/axelrod/strategies/inverse.py Inverse.strategy/VarMisuse@51/111 `index`->`opponent`