📚 The CoCalc Library - books, templates and other resources
1class AverageTitForTat(): 2 3 def step(self, history, round): 4 import math 5 if round == 0: 6 action = 0 7 else: 8 past = [] 9 for act in history[self.order^1]: 10 past.append(act) 11 past = sum(past)/len(past) 12 action = int(math.floor(past)) 13 14 return action 15 16