import random
class Smart():
''' Smart will choose to defect or cooperate depending on
the opponents past moves.
'''
def step(self, history, round):
if (round == 0) or (round == 1):
action = random.randint(0, 1)
elif sum(history[not self.order][round-4:round-1])/3 == (1 or 0):
action = 0
else:
action = history[not self.order][round - 2]
return action