Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
1
class scummyPrisoner():
2
def step(self, history, rd):
3
if len(history[self.order^1][int(len(history[self.order^1]) * .75):]) > 0:
4
oppAvg = sum(history[self.order^1][int(len(history[self.order^1]) * .75):]) / len(history[self.order^1][int(len(history[self.order^1]) * .75):]) if rd > 0 else 0
5
else:
6
oppAvg = 0
7
return 0 if oppAvg >= .75 else 1 if (oppAvg < .75 and oppAvg >= .5) else 0
8