You are viewing a single comment's thread from:
RE: The AI Contest #1: public goods problem
Here's a Conservative bot to fuel the contest. Not a great one, I'm not here to grab the reward, but it will populate the arena. Feel free to provide more than one bot each.
Conservative will play ten until it sees that others are selfish, then becomes and stays selfish.
def getSteemUser(self):
return "@gbd"
def think(self, context):
self.lastMove = self.thinkDetails(context)
return self.lastMove
def thinkDetails(self, context):
# First round: TEN
if (context.roundIndex == 0):
return Bet.TEN
# Other rounds: were they generous last turn?
nbUrchins = sum(c.previousMoves[context.roundIndex-1] == Bet.NOTHING for c in context.playerContexts.values())
if (self.lastMove == Bet.NOTHING or nbUrchins > 6):
return Bet.NOTHING
return Bet.TEN