@staticmethod
    def strategy(opponent):
        """Looks at opponent history to see if they have defected.

        If so, player defection is inversely proportional to when this occurred.
        """

        index = next((index for index, value in enumerate(opponent.history, start=1) if value == D), None)

        if index is None:
            return C

        return random_choice(1 - 1 / float(abs(index)))
dataset/ETHPy150Open Axelrod-Python/Axelrod/axelrod/strategies/inverse.py/Inverse.strategy/original